Making WordPress.org

Changeset 11165


Ignore:
Timestamp:
08/03/2021 04:24:09 AM (3 years ago)
Author:
dd32
Message:

Theme Directory: Redirect ?s= searches to the canonical /search/ location.

Fixes #5848.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r11158 r11165  
    6060
    6161        wp_safe_redirect( $url ); // Not 301, as paginated requests will one day be supported hopefully.
     62        die();
     63    }
     64
     65    // Searches should be redirected to canonical location.
     66    if ( isset( $_GET['s'] ) ) {
     67        wp_safe_redirect( home_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ), 301 );
    6268        die();
    6369    }
Note: See TracChangeset for help on using the changeset viewer.