From e61075ad2a5f5e8d3fcaecaf39eac593162ab243 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 30 Jun 2020 20:36:05 +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. Built from https://develop.svn.wordpress.org/trunk@48240 git-svn-id: http://core.svn.wordpress.org/trunk@48009 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-media-list-table.php | 16 +++++++--------- wp-admin/includes/class-wp-posts-list-table.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index 5934585b50..8fc319ebed 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/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/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index de0d70c6ca..065e5d0382 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 440d58c964..408f679558 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48239'; +$wp_version = '5.5-alpha-48240'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.