Revert [18783], as it breaks term relationship counts for attachment taxonomies. see #17548.

git-svn-id: https://develop.svn.wordpress.org/trunk@18809 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2011-09-29 05:29:20 +00:00
parent 8585471f13
commit cd0ad3ead4
3 changed files with 13 additions and 18 deletions
+7 -1
View File
@@ -2445,7 +2445,13 @@ function wp_update_term_count_now( $terms, $taxonomy ) {
call_user_func($taxonomy->update_count_callback, $terms, $taxonomy);
} else {
// Default count updater
_update_post_term_count( $terms, $taxonomy );
foreach ( (array) $terms as $term) {
$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) );
do_action( 'edit_term_taxonomy', $term, $taxonomy );
$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
do_action( 'edited_term_taxonomy', $term, $taxonomy );
}
}
clean_term_cache($terms, '', false);