Set 'taxonomy' and 'term' query vars for back-compat. Fixes #12659
git-svn-id: https://develop.svn.wordpress.org/trunk@16381 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ed4788b696
commit
e72a75d2d6
|
@ -549,7 +549,8 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
|
|||
|
||||
// If there's a taxonomy
|
||||
if ( is_tax() ) {
|
||||
$tax = get_taxonomy( get_query_var('taxonomy') );
|
||||
$term = get_queried_object();
|
||||
$tax = get_taxonomy( $term->taxonomy );
|
||||
$title = single_term_title( $tax->labels->name . $t_sep, false );
|
||||
}
|
||||
|
||||
|
|
|
@ -1943,7 +1943,23 @@ class WP_Query {
|
|||
$where .= get_tax_sql( $q['tax_query'], "$wpdb->posts.ID" );
|
||||
|
||||
// Back-compat
|
||||
$cat_query = wp_list_filter( $q['tax_query'], array( 'taxonomy' => 'category', 'operator' => 'IN' ) );
|
||||
$tax_query_in = wp_list_filter( $q['tax_query'], array( 'operator' => 'IN' ) );
|
||||
if ( !empty( $tax_query_in ) ) {
|
||||
if ( !isset( $q['taxonomy'] ) ) {
|
||||
foreach ( $tax_query_in as $a_tax_query ) {
|
||||
if ( !in_array( $a_tax_query['taxonomy'], array( 'category', 'post_tag' ) ) ) {
|
||||
$q['taxonomy'] = $a_tax_query['taxonomy'];
|
||||
if ( 'slug' == $a_tax_query['field'] )
|
||||
$q['term'] = $a_tax_query['terms'][0];
|
||||
else
|
||||
$q['term_id'] = $a_tax_query['terms'][0];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cat_query = wp_list_filter( $tax_query_in, array( 'taxonomy' => 'category' ) );
|
||||
if ( !empty( $cat_query ) ) {
|
||||
$cat_query = reset( $cat_query );
|
||||
$cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
|
||||
|
@ -1953,6 +1969,7 @@ class WP_Query {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty($q['meta_key']) ) {
|
||||
$groupby = "{$wpdb->posts}.ID";
|
||||
|
|
Loading…
Reference in New Issue