From 5a2a86f84ab27e3ab3389d597f50e8c57ee62bab Mon Sep 17 00:00:00 2001 From: scribu Date: Tue, 9 Nov 2010 16:45:51 +0000 Subject: [PATCH] Allow mix of 'taxonomy' => 'foo', 'term' => 'bar' and 'foo2' => 'bar2'. Props filosofo. Fixes #15363 git-svn-id: https://develop.svn.wordpress.org/trunk@16259 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/query.php | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 7b9352380b..57b68e4386 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1472,33 +1472,33 @@ class WP_Query extends WP_Object_Query { 'field' => 'slug', 'operator' => 'IN', ); - } else { - foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { - if ( $t->query_var && !empty( $q[$t->query_var] ) ) { - $tax_query_defaults = array( - 'taxonomy' => $taxonomy, - 'field' => 'slug', - 'operator' => 'IN' - ); + } - if ( $t->rewrite['hierarchical'] ) { - $q[$t->query_var] = wp_basename( $q[$t->query_var] ); - } + foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { + if ( $t->query_var && !empty( $q[$t->query_var] ) ) { + $tax_query_defaults = array( + 'taxonomy' => $taxonomy, + 'field' => 'slug', + 'operator' => 'IN' + ); - $term = str_replace( ' ', '+', $q[$t->query_var] ); + if ( $t->rewrite['hierarchical'] ) { + $q[$t->query_var] = wp_basename( $q[$t->query_var] ); + } - if ( strpos($term, '+') !== false ) { - $terms = preg_split( '/[+]+/', $term ); - foreach ( $terms as $term ) { - $tax_query[] = array_merge( $tax_query_defaults, array( - 'terms' => array( $term ) - ) ); - } - } else { + $term = str_replace( ' ', '+', $q[$t->query_var] ); + + if ( strpos($term, '+') !== false ) { + $terms = preg_split( '/[+]+/', $term ); + foreach ( $terms as $term ) { $tax_query[] = array_merge( $tax_query_defaults, array( - 'terms' => preg_split( '/[,]+/', $term ) + 'terms' => array( $term ) ) ); } + } else { + $tax_query[] = array_merge( $tax_query_defaults, array( + 'terms' => preg_split( '/[,]+/', $term ) + ) ); } } }