WordPress.org

Make WordPress Core

Changeset 41022


Ignore:
Timestamp:
07/10/2017 11:04:26 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Comments: In WP_Comments_List_Table::extra_tablenav(), save the state of ::has_items() to a static variable, so that the value is consistent between top and bottom navigation.

This prevents "Empty Spam" and "Empty Trash" buttons from disappearing if there's only one page of comments in Spam/Trash.

Fixes #40975.

File:
1 edited

Legend:

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

    r40297 r41022  
    320320    protected function extra_tablenav( $which ) {
    321321        global $comment_status, $comment_type;
     322        static $has_items;
     323
     324        if ( ! isset( $has_items ) ) {
     325            $has_items = $this->has_items();
     326        }
    322327?>
    323328        <div class="alignleft actions">
     
    355360        }
    356361
    357         if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $this->has_items() ) {
     362        if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $has_items ) {
    358363            wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
    359364            $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
Note: See TracChangeset for help on using the changeset viewer.