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
This commit is contained in:
Sergey Biryukov 2020-06-30 20:36:05 +00:00
parent 70c8bd2333
commit e61075ad2a
3 changed files with 9 additions and 11 deletions

View File

@ -174,17 +174,15 @@ class WP_Media_List_Table extends WP_List_Table {
?>
<div class="actions">
<?php
if ( ! is_singular() ) {
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 ) {
$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 );
}

View File

@ -534,7 +534,7 @@ class WP_Posts_List_Table extends WP_List_Table {
?>
<div class="alignleft actions">
<?php
if ( 'top' === $which && ! is_singular() ) {
if ( 'top' === $which ) {
ob_start();
$this->months_dropdown( $this->screen->post_type );

View File

@ -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.