The next_posts_link() works only with original $wp_query

next_posts_link and previous_posts_link use the global $wp_query. function get_next_posts_link( $label = null, $max_page = 0 ) { global $paged, $wp_query; http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/link-template.php#L1523 That means you need to do something like this to get those to work correctly. $orig_query = $wp_query; $wp_query = new WP_Query($args); // the rest of your code $wp_query = $orig_query; If you are … Read more

Insert data in custom table during new post creation

You hook a function to save_post (for saves and updates) or publish_post for publication only. The second hook is really a variable hook of the form {$new_status}_{$post->post_type} so it will be different if you aren’t dealing with a post post type. function do_on_publish_wpse_98177($id) { // your code; $id is the post ID } add_action(‘publish_post’,’do_on_publish_wpse_98177′); Make … Read more

Displaying content to search engines but via navigation only for registered users.

You can detect where the user comes from (like Google) using HTTP_REFERER. <?php if (strpos($_SERVER[‘HTTP_REFERER’], “google”) == true) { echo “Hello Google User!”; } ?> So for your logged-in user: <?php if ( current_user_can( ‘subscriber’ ) && strpos( $_SERVER[‘HTTP_REFERER’], ‘google’ ) ) { ?> [content here] <?php } ?> Important Links wp_get_referer()