Making WordPress.org


Ignore:
Timestamp:
06/19/2018 09:44:33 AM (7 years ago)
Author:
obenland
Message:

Developer: Use query_vars correctly.

Props grapplerulrich, johnbillion, SergeyBiryukov.
Fixes #2882.

File:
1 edited

Legend:

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

    r4709 r7319  
    3131    /**
    3232     * Redirects a search query with only one result directly to that result.
     33     *
     34     * @globals \WP_Query $wp_query Global WP_Query instance.
    3335     */
    3436    public static function redirect_single_search_match() {
    35         if ( is_search() && ! get_query_var( 'is_handbook' ) && 1 == $GLOBALS['wp_query']->found_posts ) {
     37        global $wp_query;
     38
     39        if ( is_search() && ! $wp_query->is_handbook && 1 == $wp_query->found_posts ) {
    3640            wp_redirect( get_permalink( get_post() ) );
    3741            exit();
Note: See TracChangeset for help on using the changeset viewer.