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. git-svn-id: https://develop.svn.wordpress.org/trunk@41022 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2d5a59194d
commit
4c5bb9758a
|
@ -319,6 +319,11 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
*/
|
*/
|
||||||
protected function extra_tablenav( $which ) {
|
protected function extra_tablenav( $which ) {
|
||||||
global $comment_status, $comment_type;
|
global $comment_status, $comment_type;
|
||||||
|
static $has_items;
|
||||||
|
|
||||||
|
if ( ! isset( $has_items ) ) {
|
||||||
|
$has_items = $this->has_items();
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="alignleft actions">
|
<div class="alignleft actions">
|
||||||
<?php
|
<?php
|
||||||
|
@ -354,7 +359,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $this->has_items() ) {
|
if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $has_items ) {
|
||||||
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
|
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
|
||||||
$title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
|
$title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
|
||||||
submit_button( $title, 'apply', 'delete_all', false );
|
submit_button( $title, 'apply', 'delete_all', false );
|
||||||
|
|
Loading…
Reference in New Issue