最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Admin is showing all posts on page 1

programmeradmin3浏览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.

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.

Share Improve this question asked Sep 11, 2015 at 14:59 v3ntv3nt 1,6897 gold badges36 silver badges54 bronze badges 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
 |  Show 2 more comments

1 Answer 1

Reset to default 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论