Compute in_search_post_types only when needed. Props mitchoyoshitaka. fixes #18364
git-svn-id: http://svn.automattic.com/wordpress/trunk@19078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
39dc973965
commit
94dfc448b0
|
@ -2385,13 +2385,11 @@ class WP_Query {
|
||||||
$post_type_cap = $post_type;
|
$post_type_cap = $post_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
$exclude_post_types = '';
|
|
||||||
$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
|
|
||||||
if ( ! empty( $in_search_post_types ) )
|
|
||||||
$exclude_post_types .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')");
|
|
||||||
|
|
||||||
if ( 'any' == $post_type ) {
|
if ( 'any' == $post_type ) {
|
||||||
$where .= $exclude_post_types;
|
$exclude_post_types = '';
|
||||||
|
$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
|
||||||
|
if ( ! empty( $in_search_post_types ) )
|
||||||
|
$where .= $wpdb->prepare(" AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')");
|
||||||
} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
|
} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
|
||||||
$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
|
$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
|
||||||
} elseif ( ! empty( $post_type ) ) {
|
} elseif ( ! empty( $post_type ) ) {
|
||||||
|
|
Loading…
Reference in New Issue