Email Post Attachment on wp_insert_post Action

After asking this question in several places and not getting a solution, I found the solution this morning myself. Instead of hooking the function send_email_on_pending_post_creation to the “wp_insert_post” action, you need to hook it to the “add_attachment” action which occurs AFTER the post is inserted and when the attachment is added to the post. You … Read more

Inserting custom data to the_post() during loop

Yep, it’s not very common, but perfectly viable and nifty technique. After the posts are retrieved in WP_Query they are passed through the_posts filter like this (where $this is WP_Query instance): $this->posts = apply_filters_ref_array( ‘the_posts’, array( $this->posts, &$this ) ); You just loop through array and assign the extra data you need to objects. Don’t … Read more

Posts not showing on page

There aren’t any errors in your code. I’m able to copy / paste it into functions.php and return 3 posts categorized under “testimonials” without issue. By default this WP_Query will retrieve only ‘post’ matches so if you are using pages or a custom post type you’ll need to specify that in your query args as: … Read more

Driving a random quote like functionality with database

From your comments I don’t really know why you should not make use of custom post types and custom fields. So what is you have extra flexibility from the above. IMHO, extra flexibility is always a plus when attempting something like this. The other plus points here are that you don’t have to make use … Read more

How to add pagination in between post and comments?

I got my solution. <?php // move pagination links above other end-of-post content additions, like related posts etc. function move_pagination( $content ) { if ( is_single() ) { $pagination = wp_link_pages( array( ‘before’ => ‘<div class=”page-links”><span class=”page-links-title”>’ . __( ‘Pages:’, ‘firmness’ ) . ‘</span>’, ‘after’ => ‘</div>’, ‘link_before’ => ‘<span>’, ‘link_after’ => ‘</span>’, ‘echo’ => … Read more

Restrict users post for himself

Try this code: (edited code a little) add_action( ‘template_redirect’, ‘my_page_template_redirect’ ); function my_page_template_redirect() { global $post; if( is_user_logged_in() ) { if( is_single() ){ if( $post->post_author != get_current_user_id() ){ wp_redirect( ‘IN ANY PAGE’ ); } } }else{ wp_redirect( ‘IN ANY PAGE’ ); } }

Removing rel=”nofollow” from links posted in Post Content

These links are generated by alx_social_links() function. So in your theme’s functions.php file, search for alx_social_links() function and this link specifically. echo ‘<li><a rel=”nofollow” class=”social-tooltip” ‘.$title.’ ‘.$link.’ ‘.$target.’><i ‘.$icon.’ ‘.$color.’></i></a></li>’; and remove rel=”nofollow” from it. So this will be the new link. echo ‘<li><a class=”social-tooltip” ‘.$title.’ ‘.$link.’ ‘.$target.’><i ‘.$icon.’ ‘.$color.’></i></a></li>’; It will remove nofollow tag … Read more

JSON – Permission Error?

Your problem is that you are checking for nonce and the nonce is stale. It is hard to make a specific comment about the need of using nonce in your case, but in general nonces should be used only for data submission not query.