WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The same old problem and not sure if its even possible.

Pagination on a single.php custom post type, is it possible?

This works fine until i turn permalinks to /%postname%/ then it just reloads the same page when click on the previous/next links,

  $temp = $wp_query; 
  $wp_query = null; 
  $wp_query = new WP_Query(); 

  while ($wp_query->have_posts()) : $wp_query->the_post(); 

  <?php the_title(); ?>

<?php endwhile; ?>

<?php previous_posts_link('&laquo; Newer') ?>
<?php next_posts_link('Older &raquo;') ?>

<?php $wp_query = null;  $wp_query = $temp;?>

I've refreshed the permalinks, removed the htaccess, made sure a page is not the same name everything that you'd usually do.

Is it just not possible to have permalinks on for pagination on a single custom post type page?

share|improve this question
I would use a plugin like this wordpress.org/extend/plugins/wp-pagenavi or you can use your own function like the one here wp-snippets.com/pagination-without-plugin – Rezen Aug 30 '12 at 16:27
up vote 1 down vote accepted

The problem is you're using next_posts_link() etc... note the plural form 'posts'.

To link to previous and next single posts you need to use next_post_link() and previous_post_link().

Basically change 'posts' to 'post' in the function names.

share|improve this answer
+1. Also: what is the need for the custom query? It's not necessary for displaying the single-post page for a custom post type. WordPress handles custom post type queries out-of-the-box. – Chip Bennett Aug 30 '12 at 16:35
Thanks, i was being stupid. – user4630 Aug 31 '12 at 15:13
No worries, easily done :) – sanchothefat Sep 3 '12 at 11:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.