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
This commit is contained in:
Scott Taylor 2014-05-29 20:49:28 +00:00
parent 8bb2117aad
commit 8f247884c2
1 changed files with 7 additions and 7 deletions

View File

@ -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.