Make WordPress Core

Changeset 35683


Ignore:
Timestamp:
11/18/2015 08:24:44 PM (9 years ago)
Author:
wonderboymusic
Message:

List Tables: After [35622] and [34271], improve pagination logic when queries are altered.

Props bradyvercher.
Fixes #29870.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r35682 r35683  
    152152        if ( $this->hierarchical_display ) {
    153153            $total_items = $wp_query->post_count;
    154         } elseif ( isset( $_REQUEST['s'] ) ) {
     154        } elseif ( $wp_query->found_posts || $this->get_pagenum() === 1 ) {
    155155            $total_items = $wp_query->found_posts;
    156156        } else {
     
    173173        }
    174174
    175         $total_pages = ceil( $total_items / $per_page );
    176 
    177175        if ( ! empty( $_REQUEST['mode'] ) ) {
    178176            $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list';
     
    186184        $this->set_pagination_args( array(
    187185            'total_items' => $total_items,
    188             'total_pages' => $total_pages,
    189186            'per_page' => $per_page
    190187        ) );
Note: See TracChangeset for help on using the changeset viewer.