mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 11:14:36 +00:00
Kill the query in the following edge case: post_type => 'any' but exclude_from_search => false returns no valid post types. Adds unit tests.
Props mitchoyoshitaka. Fixes #19198. git-svn-id: https://develop.svn.wordpress.org/trunk@25239 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2455,7 +2455,9 @@ class WP_Query {
|
||||
|
||||
if ( 'any' == $post_type ) {
|
||||
$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
|
||||
if ( ! empty( $in_search_post_types ) )
|
||||
if ( empty( $in_search_post_types ) )
|
||||
$where .= ' AND 1=0 ';
|
||||
else
|
||||
$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
|
||||
} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
|
||||
$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
|
||||
|
||||
Reference in New Issue
Block a user