Allow mix of 'taxonomy' => 'foo', 'term' => 'bar' and 'foo2' => 'bar2'. Props filosofo. Fixes #15363
git-svn-id: http://svn.automattic.com/wordpress/trunk@16259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3a7d16a308
commit
e9952075ee
|
@ -1472,33 +1472,33 @@ class WP_Query extends WP_Object_Query {
|
||||||
'field' => 'slug',
|
'field' => 'slug',
|
||||||
'operator' => 'IN',
|
'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'] ) {
|
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
|
||||||
$q[$t->query_var] = wp_basename( $q[$t->query_var] );
|
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 ) {
|
$term = str_replace( ' ', '+', $q[$t->query_var] );
|
||||||
$terms = preg_split( '/[+]+/', $term );
|
|
||||||
foreach ( $terms as $term ) {
|
if ( strpos($term, '+') !== false ) {
|
||||||
$tax_query[] = array_merge( $tax_query_defaults, array(
|
$terms = preg_split( '/[+]+/', $term );
|
||||||
'terms' => array( $term )
|
foreach ( $terms as $term ) {
|
||||||
) );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$tax_query[] = array_merge( $tax_query_defaults, array(
|
$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 )
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue