Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #49178, comment 7


Ignore:
Timestamp:
09/03/2020 08:26:56 PM (3 years ago)
Author:
Mista-Flo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #49178, comment 7

    initial v1  
    66
    77With my patch, it now displays messages even in grid mode, and also unset from the $_GET superglobal the deleted and other params like this that was avoiding new uploaded images to get displayed in the grid.
     8
     9You can have a closer look to this code:
     10
     11{{{#!php
     12<?php
     13        $q = $_GET;
     14        // Let JS handle this.
     15        unset( $q['s'] );
     16        $vars   = wp_edit_attachments_query_vars( $q );
     17        $ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
     18        foreach ( $vars as $key => $value ) {
     19                if ( ! $value || in_array( $key, $ignore, true ) ) {
     20                        unset( $vars[ $key ] );
     21                }
     22        }
     23}}}
     24
     25It might be a better option to ignore deleted and other params set, but I am not sure about the consequences.