Account for taxonomies tied to specific kinds of attachments when setting up post types for a taxonomy query.

props jondavidjohn. see #21290.



git-svn-id: https://develop.svn.wordpress.org/trunk@22718 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-11-20 17:33:21 +00:00
parent 2e6be2d063
commit 628778d7c1
1 changed files with 2 additions and 1 deletions

View File

@ -2224,7 +2224,8 @@ class WP_Query {
$post_type = array();
$taxonomies = wp_list_pluck( $this->tax_query->queries, 'taxonomy' );
foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
if ( array_intersect( $taxonomies, get_object_taxonomies( $pt ) ) )
$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
if ( array_intersect( $taxonomies, $object_taxonomies ) )
$post_type[] = $pt;
}
if ( ! $post_type )