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: http://core.svn.wordpress.org/trunk@22718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-20 17:33:21 +00:00
parent 530d5248f7
commit fa10ccba23

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 )