Make WordPress Core

Changeset 48240


Ignore:
Timestamp:
06/30/2020 08:33:32 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r48102 r48240  
    175175        <div class="actions">
    176176        <?php
    177         if ( ! is_singular() ) {
    178             if ( ! $this->is_trash ) {
    179                 $this->months_dropdown( 'attachment' );
    180             }
    181 
    182             /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
    183             do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
    184 
    185             submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
    186         }
     177        if ( ! $this->is_trash ) {
     178            $this->months_dropdown( 'attachment' );
     179        }
     180
     181        /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
     182        do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
     183
     184        submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
    187185
    188186        if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r48203 r48240  
    535535        <div class="alignleft actions">
    536536        <?php
    537         if ( 'top' === $which && ! is_singular() ) {
     537        if ( 'top' === $which ) {
    538538            ob_start();
    539539
Note: See TracChangeset for help on using the changeset viewer.