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) . "')"; } }