0

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.

7
  • Maybe something in your theme that's interfering?
    – birgire
    Commented Sep 11, 2015 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
    Commented Sep 11, 2015 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
    Commented Sep 11, 2015 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
    Commented Sep 11, 2015 at 15:10
  • screen options say 20 too.
    – v3nt
    Commented Sep 11, 2015 at 15:18

1 Answer 1

0

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

if(!is_admin()){
// code
}

So it doesn't run in the admin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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