mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
In WP_Query::get_queried_object(), use the new format for referencing tax query clauses.
`queried_terms`, rather than `queries`, is the tax_query property where a flat index of terms is stored. See [29901] for a similar fix in `redirect_canonical()`. See #29738. Props dd32. Fixes #30623. git-svn-id: https://develop.svn.wordpress.org/trunk@30771 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3869,14 +3869,18 @@ class WP_Query {
|
||||
$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
|
||||
}
|
||||
} else {
|
||||
$tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
|
||||
$query = reset( $tax_query_in_and );
|
||||
// For other tax queries, grab the first term from the first clause.
|
||||
$tax_query_in_and = wp_list_filter( $this->tax_query->queried_terms, array( 'operator' => 'NOT IN' ), 'NOT' );
|
||||
|
||||
$queried_taxonomies = array_keys( $tax_query_in_and );
|
||||
$matched_taxonomy = reset( $queried_taxonomies );
|
||||
$query = $tax_query_in_and[ $matched_taxonomy ];
|
||||
|
||||
if ( $query['terms'] ) {
|
||||
if ( 'term_id' == $query['field'] ) {
|
||||
$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
|
||||
$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
|
||||
} else {
|
||||
$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
|
||||
$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user