Comments: Use the existing static variable instead of calling ::has_items() again in WP_Comments_List_Table::extra_tablenav().

Additionally, removed unnecessary `esc_html()` on the Filter button label. Core translations are considered safe, and this label is not escaped in any other instance.

Props whyisjake, SergeyBiryukov.
Fixes #40188.

git-svn-id: https://develop.svn.wordpress.org/trunk@48722 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-08-04 15:55:25 +00:00
parent 39be04b2c2
commit 21c0ed05c4
3 changed files with 7 additions and 2 deletions

View File

@ -397,6 +397,7 @@ class WP_Comments_List_Table extends WP_List_Table {
ob_start();
$this->comment_status_dropdown( $comment_type );
/**
* Fires just before the Filter submit button for comment types.
*
@ -406,9 +407,9 @@ class WP_Comments_List_Table extends WP_List_Table {
$output = ob_get_clean();
if ( ! empty( $output ) && $this->has_items() ) {
if ( ! empty( $output ) && $has_items ) {
echo $output;
submit_button( esc_html__( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
}
}

View File

@ -115,7 +115,9 @@ class WP_Links_List_Table extends WP_List_Table {
);
echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>';
wp_dropdown_categories( $dropdown_options );
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
?>
</div>

View File

@ -332,7 +332,9 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
* @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
*/
do_action( 'restrict_manage_sites', $which );
$output = ob_get_clean();
if ( ! empty( $output ) ) {
echo $output;
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) );