| 8 | |
| 9 | You 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 | |
| 25 | It might be a better option to ignore deleted and other params set, but I am not sure about the consequences. |