Filtering by Category doesnt paginate correctly on the backend

Description of Issue

Right now, on the WordPress Admin Dashboard, we have 300 posts in our blog. 250 of those posts are in the category “Blog”. We’re trying to filter the posts to only show posts in the Blog Category. So, we click the dropdown and filter that way or we go to the categories page and click on the posts number link to the right of the table row.

We also have a posts per page settings in the Screen Options set to 300 posts per page.

Expected Behavior:

When selecting the category filter, we can see all of the posts, since we should have 300 posts per page. If there was more than 300 posts, we’d have pagination at the bottom.

Actual Behavior:

WordPress only displays 8 posts (while stating that there’s 250 total “Blog” posts), and has no pagination available in the bottom right corner.

Attempted Fixes

  • Tried reducing the posts per page to 50 to force pagination. What Happened It created the pagination at the bottom right, but when going to “page 2” it shows the same 8 posts.
  • Tried enabling WP_ALLOW_REPAIR and hitting the HOST/wp-admin/maint/repair.php. What happened: The script returned that it didn’t repair anything, both for “Repair Database” and “Repair & Optimize Database”

1 Answer
1

Looks as though we had mistakenly added a posts per page onto the pre_get_posts filter that was limiting not just the front end, but the backend too.

We simply wrapped that code with !is_admin() and we were good to go!

Leave a Comment