Title: next_posts_link doesn&#8217;t work
Last modified: August 19, 2016

---

# next_posts_link doesn’t work

 *  [Orabidoo](https://wordpress.org/support/users/orabidoo/)
 * (@orabidoo)
 * [16 years ago](https://wordpress.org/support/topic/next_posts_link-doesnt-work/)
 * I’ve put the links before the else and endif statements of the loop, and clicking
   previous entries reloads the page with **paged=2**, but it still shows the 5 
   newest entries.
 * <?php next_posts_link(‘Previous Entries’) ?> <?php previous_posts_link(‘Next 
   Entries’) ?>
 * Before the loop I set the number of posts to be displayed: <?php query_posts(‘
   posts_per_page=5’); ?>

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

 *  Thread Starter [Orabidoo](https://wordpress.org/support/users/orabidoo/)
 * (@orabidoo)
 * [16 years ago](https://wordpress.org/support/topic/next_posts_link-doesnt-work/#post-1500112)
 * Update: I removed <?php query_posts(‘posts_per_page=5’); ?> and now I can view
   different categories and single posts by clicking the links. But how can I set
   the loop to only display five posts?
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [16 years ago](https://wordpress.org/support/topic/next_posts_link-doesnt-work/#post-1500113)
 * You need to use the ‘paged’ parameter in the query:
 *     ```
       <?php $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
       query_posts('posts_per_page=5&paged='.$paged); ?>
       ```
   

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

The topic ‘next_posts_link doesn’t work’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/next_posts_link-doesnt-work/#post-1500113)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
