[wp-trac] [WordPress Trac] #39968: Media Library: deleting all items on the last page loses the pagination/navigation buttons and shows message

WordPress Trac noreply at wordpress.org
Tue Dec 1 02:51:52 UTC 2020


#39968: Media Library: deleting all items on the last page loses the
pagination/navigation buttons and shows message
------------------------------+-----------------------
 Reporter:  donsony           |       Owner:  antpb
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:  5.6
Component:  Media             |     Version:  4.7.2
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:  ui
------------------------------+-----------------------
Changes (by iCaleb):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Hi all,

 This changeset means that the total count and pagination in the media
 library will no longer take additional query filtering into account.

 Example issue we just ran into with this patch applied:

 {{{#!php
 add_action( 'pre_get_posts', function( $query ) {
         $display_all = filter_input( INPUT_GET, 'example-filter',
 FILTER_SANITIZE_STRING );

         if ( 'all' !== $display_all ) {
                 $query->set( 'meta_key', 'some_meta_key' );
         }
 } );
 }}}

 Before this patch, the pagination/total count would be correct with and
 without the filtering. But now with the patch applied, the pagination
 displays far more pages than needed with the latter half all being blank.

 I can open a new ticket if needed for this bug, but seemed more fitting to
 go here. Need to take another look at how to resolve this bug without
 removing the ability to filter the $wp_query.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/39968#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list