From 691eccf4007f9e94464533cfa7bbe24dd7fc1c34 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 16 May 2008 01:43:35 +0000 Subject: [PATCH] Use TT ids instead of term ids. Hat tip: andy. git-svn-id: http://svn.automattic.com/wordpress/trunk@7939 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 4b15da22f..4955f07db 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1303,10 +1303,10 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) { if ( ! $append && isset($t->sort) && $t->sort ) { $values = array(); $term_order = 0; - $final_term_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); - foreach ( $term_ids as $term_id ) - if ( in_array($term_id, $final_term_ids) ) - $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $term_id, ++$term_order); + $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); + foreach ( $tt_ids as $tt_id ) + if ( in_array($tt_id, $final_tt_ids) ) + $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order); if ( $values ) $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)"); }