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
This commit is contained in:
Sergey Biryukov 2020-06-30 20:33:32 +00:00
parent 9ab408d9f6
commit b9871a67cb
2 changed files with 8 additions and 10 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 );