From a4207b955e150797e4587e5baa91439560c14263 Mon Sep 17 00:00:00 2001 From: azaozz Date: Sat, 25 Apr 2009 07:48:17 +0000 Subject: [PATCH] Fix category__not_in and tag__not_in running empty, props coffee2code, fixes #9645 git-svn-id: http://svn.automattic.com/wordpress/trunk@11086 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index efd0a06544..2804664161 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1804,12 +1804,8 @@ class WP_Query { $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )"; } else { $ids = get_objects_in_term($q['category__not_in'], 'category'); - if ( is_wp_error( $ids ) ) - $ids = array(); - if ( is_array($ids) && count($ids > 0) ) { - $out_posts = "'" . implode("', '", $ids) . "'"; - $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)"; - } + if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) + $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; } } @@ -1897,12 +1893,8 @@ class WP_Query { $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )"; } else { $ids = get_objects_in_term($q['tag__not_in'], 'post_tag'); - if ( is_wp_error( $ids ) ) - $ids = array(); - if ( is_array($ids) && count($ids > 0) ) { - $out_posts = "'" . implode("', '", $ids) . "'"; - $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)"; - } + if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) + $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; } }