| 1 | Index: wp-includes/query.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/query.php (revision 21544) |
|---|
| 4 | +++ wp-includes/query.php (working copy) |
|---|
| 5 | @@ -2216,6 +2216,18 @@ |
|---|
| 6 | if ( $this->is_tax ) { |
|---|
| 7 | if ( empty($post_type) ) { |
|---|
| 8 | $post_type = 'any'; |
|---|
| 9 | + |
|---|
| 10 | + // do a fully inclusive search for registered post types of queried taxonomies |
|---|
| 11 | + $tax_post_types = array(); |
|---|
| 12 | + $taxonomies = wp_list_pluck( $this->tax_query->queries, 'taxonomy' ); |
|---|
| 13 | + foreach ( get_post_types() as $post_type ) { |
|---|
| 14 | + $post_type_taxonomies = get_object_taxonomies($post_type); |
|---|
| 15 | + if ( array_intersect($taxonomies, $post_type_taxonomies) ) |
|---|
| 16 | + $tax_post_types[] = $post_type; |
|---|
| 17 | + } |
|---|
| 18 | + if ( $tax_post_types ) |
|---|
| 19 | + $post_type = $tax_post_types; |
|---|
| 20 | + |
|---|
| 21 | $post_status_join = true; |
|---|
| 22 | } elseif ( in_array('attachment', (array) $post_type) ) { |
|---|
| 23 | $post_status_join = true; |
|---|