WordPress.org

Make WordPress Core

Ticket #11003: 11003.diff

File 11003.diff, 1.7 KB (added by dd32, 4 years ago)
  • wp-includes/taxonomy.php

     
    12831283        else if ( 'all_with_object_id' == $fields ) 
    12841284                $select_this = 't.*, tt.*, tr.object_id'; 
    12851285 
    1286         $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order"; 
     1286        $query = "SELECT DISTINCT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order"; 
    12871287 
    12881288        if ( 'all' == $fields || 'all_with_object_id' == $fields ) { 
    12891289                $terms = array_merge($terms, $wpdb->get_results($query)); 
     
    12911291        } else if ( 'ids' == $fields || 'names' == $fields ) { 
    12921292                $terms = array_merge($terms, $wpdb->get_col($query)); 
    12931293        } else if ( 'tt_ids' == $fields ) { 
    1294                 $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order"); 
     1294                $terms = $wpdb->get_col("SELECT DISTINCT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order"); 
    12951295        } 
    12961296 
    12971297        if ( ! $terms )