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've got a page template called tpl-memos.php which is attached to a page called 'Memos' with a parent page called 'About', the permalink for the page therefor is example.com/about/memos. On this page a custom post type called 'info' is listing its posts, and this custom post type has a rewrite of '/about/memos' – the same as the page structure.

This is working pretty good: the posts from the CPT is listed and they get the correct URL, example.com/about/memos/%post_name% and of course it's a single-info.php file that is used to output the posts.

My only problem is that I can't seem to get the pagination correct, when clicking 'Previous posts' all I get is a 404 error.

Here's some code from tpl-memos.php, nothing special:

query_posts(array('post_type' => 'info', 'posts_per_page' => 10, 'paged' => $paged));

if (have_posts()):
    while (have_posts()): the_post();
        // Some content
    endwhile; ?>

    <div class="navigation">
        <span class="alignright"><?php previous_posts_link(); ?></span>
        <span class="alignleft"><?php next_posts_link(); ?></span>
<?php endif; ?>
share|improve this question
up vote 0 down vote accepted

What i found was the easiest way to solve this problem – and what i eventually ended up doing – was to build a custom pagination using querystrings.

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.