From ae3d1fccfbb4f8363f454b1107c26265edc37f17 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 29 May 2014 20:50:15 +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. Built from https://develop.svn.wordpress.org/trunk@28623 git-svn-id: http://core.svn.wordpress.org/trunk@28444 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index ddf67d564e..d523bcc351 100644 --- a/wp-includes/query.php +++ b/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.