Prevent db error when dealing with unexistant parent term. See #12891
git-svn-id: http://svn.automattic.com/wordpress/trunk@15734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -696,8 +696,15 @@ class WP_Object_Query {
|
||||
foreach ( $this->tax_query as $query ) {
|
||||
if ( !isset( $query['include_children'] ) )
|
||||
$query['include_children'] = true;
|
||||
|
||||
$query['do_query'] = false;
|
||||
$sql[] = get_objects_in_term( $query['terms'], $query['taxonomy'], $query );
|
||||
|
||||
$sql_single = get_objects_in_term( $query['terms'], $query['taxonomy'], $query );
|
||||
|
||||
if ( empty( $sql_single ) )
|
||||
return ' AND 0 = 1';
|
||||
|
||||
$sql[] = $sql_single;
|
||||
}
|
||||
|
||||
if ( 1 == count( $sql ) ) {
|
||||
|
||||
Reference in New Issue
Block a user