Ticket #11003: wp_get_object_terms-unique-results.11003.diff
File wp_get_object_terms-unique-results.11003.diff, 859 bytes (added by , 15 years ago) |
---|
-
wp-includes/taxonomy.php
1291 1291 $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"); 1292 1292 } 1293 1293 1294 if ( ! $terms ) 1295 $terms = array(); 1294 if ( in_array($fields, array('ids', 'names', 'tt_ids') ) ) { 1295 $terms = array_unique((array) $terms); 1296 } else { 1297 $_terms = array(); 1298 foreach( (array) $terms as $term ) { 1299 $_terms[$term->term_id] = $term; 1300 } 1301 $terms = $_terms; 1302 } 1296 1303 1297 1304 return apply_filters('wp_get_object_terms', $terms, $object_ids, $taxonomies, $args); 1298 1305 }