mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-02 05:31:25 +01:00
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
This commit is contained in:
parent
d0bdcc3e7a
commit
ae3d1fccfb
@ -1510,10 +1510,11 @@ class WP_Query {
|
|||||||
$this->is_page = true;
|
$this->is_page = true;
|
||||||
$this->is_single = false;
|
$this->is_single = false;
|
||||||
} else {
|
} 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;
|
$this->is_search = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( '' !== $qv['second'] ) {
|
if ( '' !== $qv['second'] ) {
|
||||||
$this->is_time = true;
|
$this->is_time = true;
|
||||||
@ -2261,10 +2262,6 @@ class WP_Query {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->is_search ) {
|
|
||||||
$search = 'AND 0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $this->is_feed ) {
|
if ( $this->is_feed ) {
|
||||||
// This overrides posts_per_page.
|
// This overrides posts_per_page.
|
||||||
if ( ! empty( $q['posts_per_rss'] ) ) {
|
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 a search pattern is specified, load the posts that match.
|
||||||
if ( ! empty( $q['s'] ) )
|
if ( ! empty( $q['s'] ) ) {
|
||||||
$search = $this->parse_search( $q );
|
$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.
|
* Filter the search SQL that is used in the WHERE clause of WP_Query.
|
||||||
|
Loading…
Reference in New Issue
Block a user