Make WordPress Core


Ignore:
Timestamp:
11/20/2010 09:28:50 PM (14 years ago)
Author:
scribu
Message:

Fix logic for when excluding a non-existant term. See #12891

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/taxonomy.php

    r16511 r16512  
    553553            _transform_terms( $terms, $taxonomies, $field, 'term_id' );
    554554
    555             if ( empty( $terms ) )
    556                 continue;
    557 
    558555            $children = array();
    559556            foreach ( $terms as $term ) {
     
    569566        }
    570567
    571         if ( empty( $terms ) )
    572             continue;
    573 
    574         $terms = implode( ',', $terms );
    575 
    576568        if ( 'IN' == $operator ) {
     569            if ( empty( $terms ) )
     570                return array( 'join' => '', 'where' => ' AND 0 = 1');
     571
     572            $terms = implode( ',', $terms );
     573
    577574            $alias = $i ? 'tt' . $i : $wpdb->term_relationships;
    578575
     
    586583        }
    587584        elseif ( 'NOT IN' == $operator ) {
     585            if ( empty( $terms ) )
     586                continue;
     587
     588            $terms = implode( ',', $terms );
     589
    588590            $where .= " AND $primary_table.$primary_id_column NOT IN (
    589591                SELECT object_id
     
    599601function _transform_terms( &$terms, $taxonomies, $field, $resulting_field ) {
    600602    global $wpdb;
     603
     604    if ( empty( $terms ) )
     605        return;
    601606
    602607    if ( $field == $resulting_field )
Note: See TracChangeset for help on using the changeset viewer.