Title: Next Previous navigation problem
Last modified: August 19, 2016

---

# Next Previous navigation problem

 *  Resolved [rjoshicool](https://wordpress.org/support/users/rjoshicool/)
 * (@rjoshicool)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/)
 * In my wordpress theme, whenever I click on the Next or Previous button, I get
   the same entries on each page. I am using this piece of code for getting the 
   posts –
 * \\ <?php query_posts(‘cat=13,14,15,16,17,18,22&showposts=5’); ?>
    \\ <?php if(
   have_posts()) : while (have_posts()) : the_post(); ?> \\ \\ <div class=”post”
   id=”post-<?php the_ID(); ?>”>
 * How can i get this problem solved?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Murmatron 2](https://wordpress.org/support/users/murmatron-2/)
 * (@murmatron-2)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873497)
 * Your code is ignoring the existing query_string. Try:
    `query_posts($query_string.'&
   cat=13,14,15,16,17,18,22&showposts=5');`
 *  Thread Starter [rjoshicool](https://wordpress.org/support/users/rjoshicool/)
 * (@rjoshicool)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873692)
 * i am not using any query_string yet.. Tried this but not working..
 *  [t3ch33](https://wordpress.org/support/users/t3ch33/)
 * (@t3ch33)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873693)
 * What Murmatron 2 means is that in this part of your code: `<?php query_posts('
   cat=13,14,15,16,17,18,22&showposts=5'); ?>`
 * you should remove the part that says showposts=5. You are telling WP that you
   only want to show 5 posts. I had this problem recently and had to remove it from
   the index page. You can go to wp-admin/options-reading.php to change “Blog pages
   show at most” to 5. That worked for me.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 8 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873694)
 * …
 * No, t3ch33, Murmatron 2 didn’t mean anything of the sort. He said exactly what
   he meant.
 * Change this code:
    `<?php query_posts('cat=13,14,15,16,17,18,22&showposts=5');?
   >`
 * To this:
    `<?php query_posts($query_string.'&cat=13,14,15,16,17,18,22&showposts
   =5'); ?>`
 * Problem solved.
 *  Thread Starter [rjoshicool](https://wordpress.org/support/users/rjoshicool/)
 * (@rjoshicool)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873705)
 * thank you all for your comments and help.
    Finally i got the problem solved. 
   I had to remove that showposts thing from my code and add an extra paged variable.
 *  [sebastianpatane](https://wordpress.org/support/users/sebastianpatane/)
 * (@sebastianpatane)
 * [16 years, 12 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873800)
 * had the same problem,
    thanks for the solution!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Next Previous navigation problem’ is closed to new replies.

## Tags

 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [next](https://wordpress.org/support/topic-tag/next/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [previous](https://wordpress.org/support/topic-tag/previous/)

 * 6 replies
 * 5 participants
 * Last reply from: [sebastianpatane](https://wordpress.org/support/users/sebastianpatane/)
 * Last activity: [16 years, 12 months ago](https://wordpress.org/support/topic/next-previous-navigation-problem/#post-873800)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
