Title: next_posts_link 404 error
Last modified: August 19, 2016

---

# next_posts_link 404 error

 *  [solidhex](https://wordpress.org/support/users/solidhex/)
 * (@solidhex)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/next_posts_link-404-error/)
 * Hi All
 * I’m working on a blog that has a featured post on the home page, followed by 
   a grid of other non-featured posts below it.
 * The structure is more or less as follows :
 *     ```
       <?php
       // necessary for the tags to show up in a custom loop
       global $wp_query;
       $wp_query->in_the_loop = true; 
   
       // custom loop
       $q_featured = new WP_Query('&category_name=featured&showposts=1');
       while ($q_featured->have_posts()) : $q_featured->the_post();
       $do_not_duplicate = $post->ID;
       ?>
       ```
   
 * // featured posts
    <?php endwhile; ?>
 *     ```
       <?php
       query_posts($query_string . '&cat=-9');
       if (have_posts()): while(have_posts()) : the_post();
       if( $post->ID == $do_not_duplicate ) continue;
       ?>
       ```
   
 * // non featured posts
 * <?php endwhile; endif; ?>
 * It’s 99.9% there, except that the next_posts_link function adds an extra page–
   it shows a third page when there are only two, which causes a 404 error. The 
   first two pages work fine.
 * Anyone else had a similar problem?

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

 *  [Xtremefaith](https://wordpress.org/support/users/xtremefaith/)
 * (@xtremefaith)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/next_posts_link-404-error/#post-1184125)
 * I’ve got the same issue right now, I’m calling it like this:
 *     ```
       <p class="pagination">
           <?php next_posts_link('&laquo; Previous Entries') ?>
           <?php previous_posts_link('Next Entries &raquo;') ?>
       </p>
       ```
   
 * But nothing appears to show up, I just get this “Sorry, the page your requested
   could not be found, or no longer exists.”
 * Any help in this area would be great!
 *  [batten1000](https://wordpress.org/support/users/batten1000/)
 * (@batten1000)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/next_posts_link-404-error/#post-1184149)
 * I have this problem as well.
 *  [shane-g](https://wordpress.org/support/users/shane-g/)
 * (@shane-g)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/next_posts_link-404-error/#post-1184150)
 * Hi,
 * Refer these articles:
 * [http://codex.wordpress.org/Next_and_Previous_Links](http://codex.wordpress.org/Next_and_Previous_Links)
   
   [http://codex.wordpress.org/Template_Tags/next_posts_link](http://codex.wordpress.org/Template_Tags/next_posts_link)
   [http://codex.wordpress.org/Template_Tags/next_post](http://codex.wordpress.org/Template_Tags/next_post)
 * Thanks,
 * Shane G.

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

The topic ‘next_posts_link 404 error’ is closed to new replies.

## Tags

 * [next_posts_link](https://wordpress.org/support/topic-tag/next_posts_link/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 4 participants
 * Last reply from: [shane-g](https://wordpress.org/support/users/shane-g/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/next_posts_link-404-error/#post-1184150)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
