From b5f0bf47ac4db286b682830fd8dcf31415ff016e Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 24 Sep 2010 12:09:44 +0000 Subject: [PATCH] Do not generate invalid SQL for empty term archives. See #12891 git-svn-id: https://develop.svn.wordpress.org/trunk@15652 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/query.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index a4f6a0dd50..3a3014df8b 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1921,7 +1921,11 @@ class WP_Query { $post_status_join = true; } - $where .= " AND $wpdb->posts.ID IN( " . implode( ', ', wp_tax_query( $tax_query ) ) . ")"; + $ids = wp_tax_query( $tax_query ); + if ( !empty($ids) ) + $where .= " AND $wpdb->posts.ID IN(" . implode( ', ', $ids ) . ")"; + else + $where .= ' AND 0 = 1'; } if ( !empty($q['meta_key']) ) {