| 952 | | if ( !empty($taxonomy->update_count_callback) ) |
|---|
| 953 | | return call_user_func($taxonomy->update_count_callback, $terms); |
|---|
| 954 | | |
|---|
| 955 | | // Default count updater |
|---|
| 956 | | foreach ($terms as $term) { |
|---|
| 957 | | $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = '$term'"); |
|---|
| 958 | | $wpdb->query("UPDATE $wpdb->term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term'"); |
|---|
| 959 | | } |
|---|
| | 947 | if ( !empty($taxonomy->update_count_callback) ) { |
|---|
| | 948 | call_user_func($taxonomy->update_count_callback, $terms); |
|---|
| | 949 | } else { |
|---|
| | 950 | // Default count updater |
|---|
| | 951 | foreach ($terms as $term) { |
|---|
| | 952 | $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = '$term'"); |
|---|
| | 953 | $wpdb->query("UPDATE $wpdb->term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term'"); |
|---|
| | 954 | } |
|---|
| | 955 | |
|---|
| | 956 | } |
|---|
| | 957 | |
|---|
| | 958 | clean_term_cache($terms); |
|---|
| 988 | | foreach ( $ids as $id ) { |
|---|
| 989 | | wp_cache_delete($id, $taxonomy); |
|---|
| 990 | | } |
|---|
| 991 | | |
|---|
| 992 | | wp_cache_delete('all_ids', $taxonomy); |
|---|
| 993 | | wp_cache_delete('get', $taxonomy); |
|---|
| 994 | | delete_option("{$taxonomy}_children"); |
|---|
| | 989 | $taxonomies = array(); |
|---|
| | 990 | // If no taxonomy, assume tt_ids. |
|---|
| | 991 | if ( empty($taxonomy) ) { |
|---|
| | 992 | $tt_ids = implode(', ', $ids); |
|---|
| | 993 | $terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)"); |
|---|
| | 994 | foreach ( (array) $terms as $term ) { |
|---|
| | 995 | $taxonomies[] = $term->taxonomy; |
|---|
| | 996 | wp_cache_delete($term->term_id, $term->taxonomy); |
|---|
| | 997 | } |
|---|
| | 998 | $taxonomies = array_unique($taxonomies); |
|---|
| | 999 | } else { |
|---|
| | 1000 | foreach ( $ids as $id ) { |
|---|
| | 1001 | wp_cache_delete($id, $taxonomy); |
|---|
| | 1002 | } |
|---|
| | 1003 | $taxonomies = array($taxonomy); |
|---|
| | 1004 | } |
|---|
| | 1005 | |
|---|
| | 1006 | foreach ( $taxonomies as $taxonomy ) { |
|---|
| | 1007 | wp_cache_delete('all_ids', $taxonomy); |
|---|
| | 1008 | wp_cache_delete('get', $taxonomy); |
|---|
| | 1009 | delete_option("{$taxonomy}_children"); |
|---|
| | 1010 | } |
|---|
| | 1011 | |
|---|