I have 900 media items on the site. For some reason the pagination has stopped working in a few sites and all the posts are being shown slowing down the site a lot. This happens on the Media library (/wp-admin/upload.php) and admin Posts list page too (/wp-admin/edit.php).

I've disabled all plugins. Posts per page is set as 20 via settings > reading.

I'm printing the query using a pre_get_posts - print_r($wp_query); and its says posts per page = 20.

Seems like the posts per page is getting messed up somehow? Any help appreciated.

  • Maybe something in your theme that's interfering? – birgire Sep 11 '15 at 15:05
  • i've had a good look and i'm certain the only theme file that can affect the admin is the functions.php. And i've searched theme wide for a posts_per_page setting. And at the top of the admin page that's showing ALL of the items its says in the spat out $wp-query 'posts_per_page' =>20. – v3nt Sep 11 '15 at 15:08
  • 1
    You could try a default theme, just to be sure (remember to backup first) or you might have mu-plugins ? – birgire Sep 11 '15 at 15:09
  • Did you check your Screen Options for the media and posts page? It's the small tab in the upper right of the screen that readds "Screen Options", clicking on it will reveal a form that allows you to configure the number of items displayed on that page. – totels Sep 11 '15 at 15:10
  • screen options say 20 too. – v3nt Sep 11 '15 at 15:18

so it was $wp_query->set('nopaging', true);

Which was set in a pre_get_posts function. I never thought of searching for this.

I've added

// code

So it doesn't run in the admin.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.