Changeset 13625
- Timestamp:
- 03/09/2010 10:48:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r13608 r13625 1857 1857 1858 1858 $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) ); 1859 do_action( 'edit_term_taxonomy', $tt_id );1859 do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); 1860 1860 $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); 1861 1861 do_action( 'edited_term_taxonomy', $tt_id ); … … 1955 1955 $taxonomy = get_taxonomy($taxonomy); 1956 1956 if ( !empty($taxonomy->update_count_callback) ) { 1957 call_user_func($taxonomy->update_count_callback, $terms );1957 call_user_func($taxonomy->update_count_callback, $terms, $taxonomy); 1958 1958 } else { 1959 1959 // Default count updater 1960 1960 foreach ( (array) $terms as $term) { 1961 1961 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); 1962 do_action( 'edit_term_taxonomy', $term );1962 do_action( 'edit_term_taxonomy', $term, $taxonomy ); 1963 1963 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); 1964 do_action( 'edited_term_taxonomy', $term );1964 do_action( 'edited_term_taxonomy', $term, $taxonomy ); 1965 1965 } 1966 1966 … … 2337 2337 2338 2338 /** 2339 * Will update term count based on posts.2339 * Will update term count based on object types of the current taxonomy. 2340 2340 * 2341 2341 * Private function for the default callback for post_tag and category … … 2349 2349 * 2350 2350 * @param array $terms List of Term taxonomy IDs 2351 */ 2352 function _update_post_term_count( $terms ) { 2351 * @param object $taxonomy Current taxonomy object of terms 2352 */ 2353 function _update_post_term_count( $terms, $taxonomy ) { 2353 2354 global $wpdb; 2354 2355 2356 $object_types = is_array($taxonomy->object_type) ? $taxonomy->object_type : array($taxonomy->object_type); 2357 $object_types = esc_sql($object_types); 2358 2355 2359 foreach ( (array) $terms as $term ) { 2356 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post'AND term_taxonomy_id = %d", $term ) );2357 do_action( 'edit_term_taxonomy', $term );2360 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type IN ('" . implode("', '", $object_types) . "') AND term_taxonomy_id = %d", $term ) ); 2361 do_action( 'edit_term_taxonomy', $term, $taxonomy ); 2358 2362 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); 2359 do_action( 'edited_term_taxonomy', $term );2363 do_action( 'edited_term_taxonomy', $term, $taxonomy ); 2360 2364 } 2361 2365 }
Note: See TracChangeset
for help on using the changeset viewer.