WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
2287 | do_action( 'edit_terms', $term_id ); |
2288 | $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); |
2289 | if ( empty($slug) ) { |
2290 | $slug = sanitize_title($name, $term_id); |
2291 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
2292 | } |
2293 | do_action( 'edited_terms', $term_id ); |
2294 |
|
2295 | $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) ); |
2296 | do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); |
2297 | $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); |
2298 | do_action( 'edited_term_taxonomy', $tt_id, $taxonomy ); |
2299 |
|
2300 | do_action("edit_term", $term_id, $tt_id, $taxonomy); |
2301 | do_action("edit_$taxonomy", $term_id, $tt_id); |
2302 |
|
2303 | $term_id = apply_filters('term_id_filter', $term_id, $tt_id); |
2304 |
|
2305 | clean_term_cache($term_id, $taxonomy); |
Line | Code |
2390 | $terms = array_map('intval', $terms); |
2391 |
|
2392 | $taxonomy = get_taxonomy($taxonomy); |
2393 | if ( !empty($taxonomy->update_count_callback) ) { |
2394 | call_user_func($taxonomy->update_count_callback, $terms, $taxonomy); |
2395 | } else { |
2396 | // Default count updater |
2397 | foreach ( (array) $terms as $term) { |
2398 | $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); |
2399 | do_action( 'edit_term_taxonomy', $term, $taxonomy ); |
2400 | $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); |
2401 | do_action( 'edited_term_taxonomy', $term, $taxonomy ); |
2402 | } |
2403 |
|
2404 | } |
2405 |
|
2406 | clean_term_cache($terms, '', false); |
2407 |
|
2408 | return true; |
Line | Code |
2791 | */ |
2792 | function _update_post_term_count( $terms, $taxonomy ) { |
2793 | global $wpdb; |
2794 |
|
2795 | $object_types = is_array($taxonomy->object_type) ? $taxonomy->object_type : array($taxonomy->object_type); |
2796 | $object_types = esc_sql($object_types); |
2797 |
|
2798 | foreach ( (array) $terms as $term ) { |
2799 | $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 ) ); |
2800 | do_action( 'edit_term_taxonomy', $term, $taxonomy ); |
2801 | $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); |
2802 | do_action( 'edited_term_taxonomy', $term, $taxonomy ); |
2803 | } |
2804 | } |
2805 |
|
2806 |
|
2807 | /** |
2808 | * Generates a permalink for a taxonomy term archive. |
2809 | * |