mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-28 15:17:42 +02:00
List Tables: After [35622] and [34271], improve pagination logic when queries are altered.
Props bradyvercher. Fixes #29870. Built from https://develop.svn.wordpress.org/trunk@35683 git-svn-id: http://core.svn.wordpress.org/trunk@35647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
af0498989c
commit
19834a4c21
@ -151,7 +151,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||||||
|
|
||||||
if ( $this->hierarchical_display ) {
|
if ( $this->hierarchical_display ) {
|
||||||
$total_items = $wp_query->post_count;
|
$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;
|
$total_items = $wp_query->found_posts;
|
||||||
} else {
|
} else {
|
||||||
$post_counts = (array) wp_count_posts( $post_type, 'readable' );
|
$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'] ) ) {
|
if ( ! empty( $_REQUEST['mode'] ) ) {
|
||||||
$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
|
$mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
|
||||||
set_user_setting ( 'posts_list_mode', $mode );
|
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(
|
$this->set_pagination_args( array(
|
||||||
'total_items' => $total_items,
|
'total_items' => $total_items,
|
||||||
'total_pages' => $total_pages,
|
|
||||||
'per_page' => $per_page
|
'per_page' => $per_page
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-beta4-35682';
|
$wp_version = '4.4-beta4-35683';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user