From b9871a67cbf8b7b78da8dbbcf56744f87b4e34b9 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 30 Jun 2020 20:33:32 +0000 Subject: [PATCH] Administration: Always show the filters on media and post list tables. Previously, the filters were hidden for single posts or attachments, which could only be achieved by editing the URL manually. The `is_singular()` check was added long before the list tables were introduced, and appears to no longer serve any purpose in the current code. As a side effect, this resolves an issue where a non-existing attachment ID in the URL would block further search in Media Library. Props afercia, tomdude, audrasjb, bencroskery, desrosj, SergeyBiryukov. Fixes #38221. git-svn-id: https://develop.svn.wordpress.org/trunk@48240 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-media-list-table.php | 16 +++++++--------- .../includes/class-wp-posts-list-table.php | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index 5934585b50..8fc319ebed 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -174,17 +174,15 @@ class WP_Media_List_Table extends WP_List_Table { ?>
is_trash ) { - $this->months_dropdown( 'attachment' ); - } - - /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ - do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); - - submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); + if ( ! $this->is_trash ) { + $this->months_dropdown( 'attachment' ); } + /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ + do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); + + submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); + if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } 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 de0d70c6ca..065e5d0382 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -534,7 +534,7 @@ class WP_Posts_List_Table extends WP_List_Table { ?>
months_dropdown( $this->screen->post_type );