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

I recently developed a custom post type for my company's blog, so that we could have a separate press area. In the archive-presse.php page I make a query, thus :

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//echo '<div style="display:hidden"> paged :'. $paged . "</div>";
$press_articles = new WP_Query(
        'post_type' => 'presse', // Tell WordPress which post type we want
        'paged' => $paged,
        'orderby'   => 'post_date',
        'posts_per_page' => '10'

and at the bottom, I create the navigation links :

<div class="navigation">
<div class="left"><?php previous_posts_link('&laquo; Zurück',$press_articles->max_num_pages) ?></div>
<div class="right"><?php next_posts_link('Weiter &raquo;',$press_articles->max_num_pages) ?></div>

(Austrian website, in case you were wondering)

On the first page, this works fine; the posts appear and so does the navigation links, which points to the second page and so on. On the third page however, when I click on 'Weiter', I end up on the 404 page, although I am sure there are still articles to be shown.

My only fix at the moment is to make sure that the posts per page is equal to a third of the total number of posts. Not much of a fix.

share|improve this question
up vote 0 down vote accepted

The problem was that one cannot apparently set 'posts_per_page' to anything other than what is set in the admin interface, even for a custom archive page.

The same code, minus the 'posts_per_page' => 'x' line, works fine.

share|improve this answer

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.