WordPress.org

Make WordPress Core

Changeset 24115


Ignore:
Timestamp:
04/27/2013 01:28:35 AM (5 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r24096 r24115  
    22382238                if ( ! $post_type )
    22392239                    $post_type = 'any';
     2240                elseif ( count( $post_type ) == 1 )
     2241                    $post_type = $post_type[0];
    22402242
    22412243                $post_status_join = true;
     
    24042406        }
    24052407
    2406         if ( is_array( $post_type ) ) {
     2408        if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
    24072409            $post_type_cap = 'multiple_post_type';
    24082410        } else {
     2411            if ( is_array( $post_type ) )
     2412                $post_type = reset( $post_type );
    24092413            $post_type_object = get_post_type_object( $post_type );
    24102414            if ( empty( $post_type_object ) )
Note: See TracChangeset for help on using the changeset viewer.