mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-01-30 05:27:40 +00:00
Fix category__not_in and tag__not_in running empty, props coffee2code, fixes #9645
git-svn-id: https://develop.svn.wordpress.org/trunk@11086 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e2c1cc6c08
commit
d812bc92a8
@ -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
Block a user