From f508d80a1ba275322e55357a3967bda240ca0f0b Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 21 Oct 2016 10:32:55 +0000 Subject: [PATCH] List Tables: Do not show filter button when there are no filter options available. Props juhise, dipesh.kakadiya, swissspidy. Fixes #37407. git-svn-id: https://develop.svn.wordpress.org/trunk@38854 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-posts-list-table.php | 10 +++- .../phpunit/tests/admin/includesListTable.php | 46 +++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 983a274f85..714a491d2e 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -459,6 +459,7 @@ class WP_Posts_List_Table extends WP_List_Table {
months_dropdown( $this->screen->post_type ); $this->categories_dropdown( $this->screen->post_type ); @@ -479,7 +480,12 @@ class WP_Posts_List_Table extends WP_List_Table { */ do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); - submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); + $output = ob_get_clean(); + + if ( ! empty( $output ) ) { + echo $output; + submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); + } } if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) { @@ -1552,7 +1558,7 @@ class WP_Posts_List_Table extends WP_List_Table { cap->assign_terms ) ) : $taxonomy_name = esc_attr( $taxonomy->name ); - + ?>