Making WordPress.org

Changeset 13703


Ignore:
Timestamp:
05/14/2024 11:01:05 PM (21 months ago)
Author:
ryelle
Message:

Theme Directory: Ingore paged param when checking whether to set a default browse.

The new block theme uses default pagination, e.g. /themes/page/2/, for the homepage. On the homepage, browse=popular is set correctly, but following pages did not set browse, causing paged requests to serve latest results instead. Ignoring paged in the default check ensures the correct browse type is used.

See https://github.com/WordPress/wporg-theme-directory/issues/68#issuecomment-2111273950.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/query-modifications.php

    r13085 r13703  
    1919    }
    2020
    21     // Default to the ~featured~ popular view
    22     if ( empty( $query->query ) ) {
     21    // Default to the popular view if this is a default query (ignore `paged`,
     22    // so that `/themes/page/2/` correctly loads popular results).
     23    $query_vars = array_diff( array_keys( $query->query ), [ 'paged' ] );
     24    if ( empty( $query_vars ) ) {
    2325        $query->query_vars['browse'] = 'popular';
    2426    }
Note: See TracChangeset for help on using the changeset viewer.