From a42be1dbb33e8dbb1547db31e4fd3de544d6242b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 13 Sep 2012 17:15:13 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 03d29fc801..bb6c6e229b 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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(