Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jefflau

    (@jefflau)

    Okay this is really weird. I’ve just been outputting one of my categories to my author pages to try and debug this problem. And on some of the author profiles, the pagination is broken. On others it works.

    One that works:

    https://www.heruni.com/author/geraldineh

    One that doesn’t:

    https://www.heruni.com/author/jeffrey

    I can’t think of any reason why this would be happening, they both run the same template, and right now, they’re both running the same loop, not even author-specific loops. So how could this be occuring?? Surely if the pagination was broken, it should be broken in both!

    Thanks in advance anyone that has read this!

    Thread Starter jefflau

    (@jefflau)

    I fixed the problem. I had to use pre_get_posts in my functions and use the main loop without wp_query or query_posts.

    would you be able to explain this further or provide a code example? I am having the same issue!

    Moderator keesiemeijer

    (@keesiemeijer)

    I think it would be something simular to this:

    add_filter('pre_get_posts', 'query_author_archive');
    function query_author_archive($query) {
    if($query->is_archive && $query->is_author){
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $query->set('paged',$paged);
    
    	      return $query;
    }
    return $query;
    }

    If that doesn’t work try it with:

    $query->set('posts_per_page', 10);

    Paul

    (@madebypaul)

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pagination not working in certain pages’ is closed to new replies.