Make WordPress Core

Ticket #18105: 18105.patch

File 18105.patch, 871 bytes (added by jakub.tyrcha, 14 years ago)
  • wp-includes/taxonomy.php

     
    656656                                }
    657657
    658658                                $terms = implode( ',', $terms );
    659 
    660                                 $alias = $i ? 'tt' . $i : $wpdb->term_relationships;
    661 
    662                                 $join .= " INNER JOIN $wpdb->term_relationships";
    663                                 $join .= $i ? " AS $alias" : '';
    664                                 $join .= " ON ($primary_table.$primary_id_column = $alias.object_id)";
    665 
    666                                 $where[] = "$alias.term_taxonomy_id $operator ($terms)";
     659                               
     660                                if( ! $i )
     661                                        $join = " INNER JOIN $wpdb->term_relationships ON ($primary_table.$primary_id_column = $wpdb->term_relationships.object_id)";
     662                               
     663                                $where[] = "$wpdb->term_relationships.term_taxonomy_id $operator ($terms)";
    667664                        } elseif ( 'NOT IN' == $operator ) {
    668665
    669666                                if ( empty( $terms ) )