Support » Fixing WordPress » STRANGE Pagination – Limit to 35 posts

  • Resolved a4aLien

    (@a4alien)



    One of the categories in use i.e. ‘clients’ has 272 total posts BUT only the 35 latest are returned, in count, in manual query against arguments, and in native-WP while-have_posts loop.

    Have tried

    'numberposts'       => -1
    'posts_per_page'    => 200

    neither brings up more than 35 (latest) posts.

    I need to loop through ALL of the posts (in a category), what am I missing?

    • This topic was modified 2 years, 2 months ago by  a4aLien.
    • This topic was modified 2 years, 2 months ago by  a4aLien.
Viewing 1 replies (of 1 total)
  • Found the ISSUE.

    Had put this code earlier (pre_get_posts) in functions.php that restricted apparently, all queries, to 35.

    function number_of_posts_on_archive($query){
    if ($query-> is_category()) {
                $query->set('posts_per_page', 35);
       }
        return $query;
    }
    
    add_filter('pre_get_posts', 'number_of_posts_on_archive');

    Alas, it took me 5 hours of extensive searching yet the culprit was sitting in my own code.

    • This reply was modified 2 years, 2 months ago by  a4aLien.
Viewing 1 replies (of 1 total)
  • The topic ‘STRANGE Pagination – Limit to 35 posts’ is closed to new replies.