mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 16:21:26 +01:00
Squash some PHP notices in taxonomy queries.
props hakre, wonderboymusic. fixes #16465. git-svn-id: http://core.svn.wordpress.org/trunk@24456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1b84d2140a
commit
bf35040898
@ -2267,6 +2267,8 @@ class WP_Query {
|
|||||||
$cat_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'category' ) );
|
$cat_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'category' ) );
|
||||||
if ( ! empty( $cat_query ) ) {
|
if ( ! empty( $cat_query ) ) {
|
||||||
$cat_query = reset( $cat_query );
|
$cat_query = reset( $cat_query );
|
||||||
|
|
||||||
|
if ( ! empty( $cat_query['terms'][0] ) ) {
|
||||||
$the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
|
$the_cat = get_term_by( $cat_query['field'], $cat_query['terms'][0], 'category' );
|
||||||
if ( $the_cat ) {
|
if ( $the_cat ) {
|
||||||
$this->set( 'cat', $the_cat->term_id );
|
$this->set( 'cat', $the_cat->term_id );
|
||||||
@ -2274,17 +2276,20 @@ class WP_Query {
|
|||||||
}
|
}
|
||||||
unset( $the_cat );
|
unset( $the_cat );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unset( $cat_query );
|
unset( $cat_query );
|
||||||
|
|
||||||
$tag_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'post_tag' ) );
|
$tag_query = wp_list_filter( $tax_query_in_and, array( 'taxonomy' => 'post_tag' ) );
|
||||||
if ( ! empty( $tag_query ) ) {
|
if ( ! empty( $tag_query ) ) {
|
||||||
$tag_query = reset( $tag_query );
|
$tag_query = reset( $tag_query );
|
||||||
|
|
||||||
|
if ( ! empty( $tag_query['terms'][0] ) ) {
|
||||||
$the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' );
|
$the_tag = get_term_by( $tag_query['field'], $tag_query['terms'][0], 'post_tag' );
|
||||||
if ( $the_tag ) {
|
if ( $the_tag )
|
||||||
$this->set( 'tag_id', $the_tag->term_id );
|
$this->set( 'tag_id', $the_tag->term_id );
|
||||||
}
|
|
||||||
unset( $the_tag );
|
unset( $the_tag );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unset( $tag_query );
|
unset( $tag_query );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user