From 0749514c94cdf43df2ba0492f2e6cf8015249422 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 18 Nov 2015 20:24:44 +0000 Subject: [PATCH] List Tables: After [35622] and [34271], improve pagination logic when queries are altered. Props bradyvercher. Fixes #29870. git-svn-id: https://develop.svn.wordpress.org/trunk@35683 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-posts-list-table.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 7fd300ebe8..d52ebc9832 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -151,7 +151,7 @@ class WP_Posts_List_Table extends WP_List_Table { if ( $this->hierarchical_display ) { $total_items = $wp_query->post_count; - } elseif ( isset( $_REQUEST['s'] ) ) { + } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) { $total_items = $wp_query->found_posts; } else { $post_counts = (array) wp_count_posts( $post_type, 'readable' ); @@ -172,8 +172,6 @@ class WP_Posts_List_Table extends WP_List_Table { } } - $total_pages = ceil( $total_items / $per_page ); - if ( ! empty( $_REQUEST['mode'] ) ) { $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; set_user_setting ( 'posts_list_mode', $mode ); @@ -185,7 +183,6 @@ class WP_Posts_List_Table extends WP_List_Table { $this->set_pagination_args( array( 'total_items' => $total_items, - 'total_pages' => $total_pages, 'per_page' => $per_page ) ); }