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.
Built from https://develop.svn.wordpress.org/trunk@30771


git-svn-id: http://core.svn.wordpress.org/trunk@30761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2014-12-07 14:58:22 +00:00
parent 8b83a73511
commit 7e69e5484f
2 changed files with 9 additions and 5 deletions

View File

@ -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 );
}
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30770';
$wp_version = '4.1-beta2-30771';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.