From 8f247884c27a82685706e52d842cd678808fc814 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 29 May 2014 20:49:28 +0000 Subject: [PATCH] Simplify the logic for determining `isset( $this->query['s'] )` after [28612], and don't limit this logic to just the main query. Props SergeyBiryukov. Fixes #11330. git-svn-id: https://develop.svn.wordpress.org/trunk@28623 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/query.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/wp-includes/query.php b/src/wp-includes/query.php index ddf67d564e..d523bcc351 100644 --- a/src/wp-includes/query.php +++ b/src/wp-includes/query.php @@ -1510,10 +1510,11 @@ class WP_Query { $this->is_page = true; $this->is_single = false; } else { + // Look for archive queries. Dates, categories, authors, search, post type archives. - // Look for archive queries. Dates, categories, authors, search, post type archives. - if ( ! empty( $qv['s'] ) || ( $this->is_main_query() && array_key_exists( 's', $this->query ) ) ) + if ( isset( $this->query['s'] ) ) { $this->is_search = true; + } if ( '' !== $qv['second'] ) { $this->is_time = true; @@ -2261,10 +2262,6 @@ class WP_Query { } } - if ( $this->is_search ) { - $search = 'AND 0'; - } - if ( $this->is_feed ) { // This overrides posts_per_page. if ( ! empty( $q['posts_per_rss'] ) ) { @@ -2477,8 +2474,11 @@ class WP_Query { } // If a search pattern is specified, load the posts that match. - if ( ! empty( $q['s'] ) ) + if ( ! empty( $q['s'] ) ) { $search = $this->parse_search( $q ); + } elseif ( $this->is_search ) { + $search = 'AND 0'; + } /** * Filter the search SQL that is used in the WHERE clause of WP_Query.