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
This commit is contained in:
parent
1d7265b4b2
commit
a4207b955e
|
@ -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) . "')";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue