Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pedrop

    (@pedrop)

    Sorry for the repeated posts. Here is a proposed patch to be applied to the file “wp-includes/query.php” at line 1042. Entire if statement at that line should be replaced with the if statement below:

    if ( !empty($q['category__not_in']) ) {
                            $cat_string= "'" . implode("', '", $q['category__not_in']) . "'";
                            $whichcat .= " AND $wpdb->posts.ID NOT IN (select $wpdb->term_relationships.object_id from $wpdb->term_relationships where $wpdb->term_relationships.term_taxonomy_id in ($cat_string) )";
                    }
    Thread Starter pedrop

    (@pedrop)

    An even easier query to read would be something like:

    …where id not in (select object_id from wp_term_relationships where term_taxonomy_id in (8,12) )…

Viewing 2 replies - 1 through 2 (of 2 total)