Make WordPress Core

Ticket #16826: 16826.diff

File 16826.diff, 806 bytes (added by scribu, 14 years ago)
  • wp-includes/taxonomy.php

     
    678678
    679679                                $terms = implode( ',', $terms );
    680680
    681                                 $where[] = "$primary_table.$primary_id_column NOT IN (
    682                                         SELECT object_id
    683                                         FROM $wpdb->term_relationships
    684                                         WHERE term_taxonomy_id IN ($terms)
    685                                 )";
     681                                $alias = $i ? 'tt' . $i : $wpdb->term_relationships;
     682
     683                                $join .= " LEFT JOIN $wpdb->term_relationships";
     684                                $join .= $i ? " AS $alias" : '';
     685                                $join .= " ON ($primary_table.$primary_id_column = $alias.object_id AND $alias.term_taxonomy_id IN ($terms))";
     686
     687                                $where[] = "$alias.object_id IS NULL";
    686688                        } elseif ( 'AND' == $operator ) {
    687689
    688690                                if ( empty( $terms ) )