Support » Fixing WordPress » Category archive won't go back past page 3

  • Resolved mrmarkham


    I just created a new category archive template for one category, and it seems to be working fine apart from one issue: if you click the “older posts” link, it’ll take you back to page three, but clicking it again gets you a 404.

    When I was creating this template, I initially did it as a separate file and created a page using that template as a way to test it out. That test works fine – it’ll let you back up all the way to the first page of posts in that category.

    What could be different between a page and the category archive that would make it behave differently? And why would it get to the third page just fine but not be able to go any further?

    My query_posts call looks like this:

    query_posts( array(
    'posts_per_page' => 5,
    'cat' => '5',
    'paged' => get_query_var('paged')

    Thanks in advance if anyone has any thoughts!

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator

    Perhaps you need to look at category templates?

    A category template IS what I’ve created. Specifically the new one I’ve created is category-news.php, since the category in question is News. What I’m wondering is why it behaves differently as a category template than it does as a generic template.

    To clarify my potentially unclear wording in my initial post – there are 6 pages worth of posts in the category, but the URLs for pages 4, 5, and 6 return 404s even though the first three pages work fine. And they ALL work fine in the test page I set up. So frustrating!

    Oh, I think I’ve got it!

    I thought of a couple keywords to search for previous topics by that I hadn’t tried yet, and managed to find this:

    Setting the max posts per page to 1 fixed the issue! (Of course, now I have author archives and tag archives displaying 1 post per page, but that should be pretty straightforward to fix!)

    ETA: Just discovered that it also works if the max posts per page is set to 5, which is awesome since that’s what I use throughout my site, so now I don’t have to change anything. Just wanted to add this in case anyone else ever runs into the same issue!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category archive won't go back past page 3’ is closed to new replies.