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 |
|---|---|
| 2335 | do_action( 'edit_terms', $term_id ); |
| 2336 | $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); |
| 2337 | if ( empty($slug) ) { |
| 2338 | $slug = sanitize_title($name, $term_id); |
| 2339 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
| 2340 | } |
| 2341 | do_action( 'edited_terms', $term_id ); |
| 2342 | |
| 2343 | $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) ); |
| 2344 | do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); |
| 2345 | $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); |
| 2346 | do_action( 'edited_term_taxonomy', $tt_id, $taxonomy ); |
| 2347 | |
| 2348 | do_action("edit_term", $term_id, $tt_id, $taxonomy); |
| 2349 | do_action("edit_$taxonomy", $term_id, $tt_id); |
| 2350 | |
| 2351 | $term_id = apply_filters('term_id_filter', $term_id, $tt_id); |
| 2352 | |
| 2353 | clean_term_cache($term_id, $taxonomy); |
| Line | Code |
| 2438 | $terms = array_map('intval', $terms); |
| 2439 | |
| 2440 | $taxonomy = get_taxonomy($taxonomy); |
| 2441 | if ( !empty($taxonomy->update_count_callback) ) { |
| 2442 | call_user_func($taxonomy->update_count_callback, $terms, $taxonomy); |
| 2443 | } else { |
| 2444 | // Default count updater |
| 2445 | foreach ( (array) $terms as $term) { |
| 2446 | $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); |
| 2447 | do_action( 'edit_term_taxonomy', $term, $taxonomy ); |
| 2448 | $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); |
| 2449 | do_action( 'edited_term_taxonomy', $term, $taxonomy ); |
| 2450 | } |
| 2451 | |
| 2452 | } |
| 2453 | |
| 2454 | clean_term_cache($terms, '', false); |
| 2455 | |
| 2456 | return true; |
| Line | Code |
| 2839 | */ |
| 2840 | function _update_post_term_count( $terms, $taxonomy ) { |
| 2841 | global $wpdb; |
| 2842 | |
| 2843 | $object_types = is_array($taxonomy->object_type) ? $taxonomy->object_type : array($taxonomy->object_type); |
| 2844 | $object_types = esc_sql($object_types); |
| 2845 | |
| 2846 | foreach ( (array) $terms as $term ) { |
| 2847 | $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 ) ); |
| 2848 | do_action( 'edit_term_taxonomy', $term, $taxonomy ); |
| 2849 | $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); |
| 2850 | do_action( 'edited_term_taxonomy', $term, $taxonomy ); |
| 2851 | } |
| 2852 | } |
| 2853 | |
| 2854 | |
| 2855 | /** |
| 2856 | * Generates a permalink for a taxonomy term archive. |
| 2857 | * |