Making WordPress.org

Changeset 11295


Ignore:
Timestamp:
10/23/2021 02:27:10 AM (3 months ago)
Author:
ryelle
Message:

Plugin Directory: Only unset the search query when bypassing the general search.

In [11292], the search term was always unset, causing general plugin search to break. Instead, the search term should only be unset when alternate queries are set up (slug matches or block search).

Fixes #5910.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-query-plugins.php

    r11292 r11295  
    9999            if ( 'slug:' === substr( $query['s'], 0, 5 ) ) {
    100100                $query['name'] = substr( $query['s'], 5 );
    101             }
    102 
    103             if ( 'block:' === substr( $query['s'], 0, 6 ) ) {
     101                unset( $query['s'], $query['block_search'] );
     102            } elseif ( 'block:' === substr( $query['s'], 0, 6 ) ) {
    104103                $query['meta_query'][] = [
    105104                    'key' => 'block_name',
     
    115114                // Prioritise block plugins, but try again without the restriction.
    116115                $try_again_without_tax_query = true;
     116                unset( $query['s'], $query['block_search'] );
    117117            }
    118 
    119             unset( $query['s'], $query['block_search'] );
    120118        }
    121119
Note: See TracChangeset for help on using the changeset viewer.