Ticket #35213: 35213.diff
File 35213.diff, 2.7 KB (added by , 8 years ago) |
---|
-
src/wp-includes/taxonomy.php
2158 2158 // Get the term before deleting it or its term relationships so we can pass to actions below. 2159 2159 $deleted_term = get_term( $term, $taxonomy ); 2160 2160 2161 $object s =$wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );2161 $object_ids = (array) $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) ); 2162 2162 2163 foreach ( (array) $objects as $object) {2164 $terms = wp_get_object_terms( $object, $taxonomy, array('fields' => 'ids', 'orderby' => 'none'));2163 foreach ( $object_ids as $object_id ) { 2164 $terms = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids', 'orderby' => 'none' ) ); 2165 2165 if ( 1 == count($terms) && isset($default) ) { 2166 2166 $terms = array($default); 2167 2167 } else { … … 2170 2170 $terms = array_merge($terms, array($default)); 2171 2171 } 2172 2172 $terms = array_map('intval', $terms); 2173 wp_set_object_terms( $object, $terms, $taxonomy);2173 wp_set_object_terms( $object_id, $terms, $taxonomy ); 2174 2174 } 2175 2175 2176 2176 // Clean the relationship caches for all object types using this term. 2177 2177 $tax_object = get_taxonomy( $taxonomy ); 2178 2178 foreach ( $tax_object->object_type as $object_type ) 2179 clean_object_term_cache( $object s, $object_type );2179 clean_object_term_cache( $object_ids, $object_type ); 2180 2180 2181 2181 $term_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->termmeta WHERE term_id = %d ", $term ) ); 2182 2182 foreach ( $term_meta_ids as $mid ) { … … 2218 2218 * @param string $taxonomy Taxonomy slug. 2219 2219 * @param mixed $deleted_term Copy of the already-deleted term, in the form specified 2220 2220 * by the parent function. WP_Error otherwise. 2221 * @param array $object_ids List of term object IDs. 2221 2222 */ 2222 do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term );2223 do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term, $object_ids ); 2223 2224 2224 2225 /** 2225 2226 * Fires after a term in a specific taxonomy is deleted. … … 2233 2234 * @param int $tt_id Term taxonomy ID. 2234 2235 * @param mixed $deleted_term Copy of the already-deleted term, in the form specified 2235 2236 * by the parent function. WP_Error otherwise. 2237 * @param array $object_ids List of term object IDs. 2236 2238 */ 2237 do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term );2239 do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term, $object_ids ); 2238 2240 2239 2241 return true; 2240 2242 }