• Hello,
    I’ve been trying to resolve a category pagination issue for weeks with no luck. I’m trying to display posts from a particular category, one post at a time. The index works, but when I go to page 2, I get a 404 error.

    <?php
    
    // The Query
    query_posts( array ( 'category_name' => 'submissions', 'posts_per_page' => 1 ) );
    
    // The Loop
    while ( have_posts() ) : the_post();
    
    endwhile;
    
    ?>

    That is the code I am using. Would that do the trick?

    I’ve also tried fixes from people who said this was a permalink issue with wordpress 3+, but none of the fixes have worked.

    Does anyone have any insight to offer? I’m at my wits end!

    Thanks-

Viewing 9 replies - 1 through 9 (of 9 total)
  • Try this:

    <?php
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var('paged') : 1;
    
    // The Query
    query_posts( array (
        'category_name' => 'submissions',
        'posts_per_page' => 1,
        'paged' => $paged
     ) );
    
    // The Loop
    while ( have_posts() ) : the_post();
    
    endwhile;
    
    ?>
    Thread Starter jillsays

    (@jillsays)

    Thanks for the reply, but nope! Page 2 is still broken with that code, and returns a 404.

    $paged is a global, so if that code is outside of a function (i.e. ‘taxonomy.php’ or ‘single.php’) then just putting 'paged' => $paged should achieve the same results. If you are running that code inside a function the add global $paged; just inside the function.

    If you are using ‘pretty permalinks’, you may be a victim of the notorious ‘Category pagination bug’. Try installing the Category Pagination Fix plugin.

    If it does not help, you can always delete it.

    Thread Starter jillsays

    (@jillsays)

    I tried the category pagination fix – it didn’t work!

    And the problem is still ongoing!

    I just completely removed all my pagination plugins, and hard-coded pagination into functions.php – and it is still happening.

    I am really at my wits end!

    I recently tried to help someone else with a pagination problem. Their pagination worked with the default permalinks, but not with ‘pretty’ permalinks. I was never able to find a cause for them.

    Does your pagination work with plain permalinks?

    Thread Starter jillsays

    (@jillsays)

    I have not tried plain permalinks, because I definitely can’t afford to lose the thousands of links I already have on the site… and have no clue how to redirect them all.

    What is strange is that this is a completely intermittent issue. It only happens sometimes – and not others. Sometimes it’s page 2, sometimes it’s page 8. It has no rhyme or reason – and it doesn’t happen to everyone. I still haven’t seen it once.

    Could it have something to do with w3 total cache?

    Unless I am mistaken, switching back and forth between default and pretty permalinks will not lose anything. At least that has been my experience.

    I believe that pretty permalinks are built ‘on the fly’ and not stored anywhere, so switching should not cause problems.

    Perhaps one of the gurus will verify that.

    Thread Starter jillsays

    (@jillsays)

    I don’t think it is permalink related. The error never happens on single post pages. It’s always just on page 2 (or a random page) of the site after the index.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PLEASE help with category pagination issue’ is closed to new replies.