Check that the taxonomy matches when calling is_tax() with only a taxonomy argument. props wonderboymusic, see #20590.

git-svn-id: http://core.svn.wordpress.org/trunk@21836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-13 17:15:13 +00:00
parent 285660c2a1
commit a42be1dbb3

View File

@ -2044,7 +2044,7 @@ class WP_Query {
if ( '' !== $q['menu_order'] )
$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
// If a month is specified in the querystring, load that month
if ( $q['m'] ) {
$q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']);
@ -3192,8 +3192,13 @@ class WP_Query {
$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
$term_array = (array) $term;
if ( empty( $term ) ) // Only a Taxonomy provided
return isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array );
// Check that the taxonomy matches.
if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
return false;
// Only a Taxonomy provided.
if ( empty( $term ) )
return true;
return isset( $queried_object->term_id ) &&
count( array_intersect(