WP_Query: If the post_type QV is an array with only one element, don't treat it as a multiple post type query.

If there is only one post type used by all taxonomies for a tax query, set the post type to the string.

fixes #24204.



git-svn-id: http://core.svn.wordpress.org/trunk@24115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-04-27 01:28:35 +00:00
parent 4885096f98
commit d334db7d4d
1 changed files with 5 additions and 1 deletions

View File

@ -2237,6 +2237,8 @@ class WP_Query {
}
if ( ! $post_type )
$post_type = 'any';
elseif ( count( $post_type ) == 1 )
$post_type = $post_type[0];
$post_status_join = true;
} elseif ( in_array('attachment', (array) $post_type) ) {
@ -2403,9 +2405,11 @@ class WP_Query {
$orderby .= " {$q['order']}";
}
if ( is_array( $post_type ) ) {
if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
$post_type_cap = 'multiple_post_type';
} else {
if ( is_array( $post_type ) )
$post_type = reset( $post_type );
$post_type_object = get_post_type_object( $post_type );
if ( empty( $post_type_object ) )
$post_type_cap = $post_type;