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:
scribu
2010-10-06 12:06:23 +00:00
parent 2a99093ba9
commit 54304cc2d4
2 changed files with 14 additions and 9 deletions

View File

@@ -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 ) ) {