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 |
---|---|
1949 | do_action( 'edit_terms', $term_id ); |
1950 | $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); |
1951 | if ( empty($slug) ) { |
1952 | $slug = sanitize_title($name, $term_id); |
1953 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
1954 | } |
1955 | do_action( 'edited_terms', $term_id ); |
1956 |
|
1957 | $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) ); |
1958 | do_action( 'edit_term_taxonomy', $tt_id, $taxonomy ); |
1959 | $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) ); |
1960 | do_action( 'edited_term_taxonomy', $tt_id, $taxonomy ); |
1961 |
|
1962 | do_action("edit_term", $term_id, $tt_id, $taxonomy); |
1963 | do_action("edit_$taxonomy", $term_id, $tt_id); |
1964 |
|
1965 | $term_id = apply_filters('term_id_filter', $term_id, $tt_id); |
1966 |
|
1967 | clean_term_cache($term_id, $taxonomy); |
Line | Code |
2052 | $terms = array_map('intval', $terms); |
2053 |
|
2054 | $taxonomy = get_taxonomy($taxonomy); |
2055 | if ( !empty($taxonomy->update_count_callback) ) { |
2056 | call_user_func($taxonomy->update_count_callback, $terms, $taxonomy); |
2057 | } else { |
2058 | // Default count updater |
2059 | foreach ( (array) $terms as $term) { |
2060 | $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); |
2061 | do_action( 'edit_term_taxonomy', $term, $taxonomy ); |
2062 | $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); |
2063 | do_action( 'edited_term_taxonomy', $term, $taxonomy ); |
2064 | } |
2065 |
|
2066 | } |
2067 |
|
2068 | clean_term_cache($terms, '', false); |
2069 |
|
2070 | return true; |
Line | Code |
2453 | */ |
2454 | function _update_post_term_count( $terms, $taxonomy ) { |
2455 | global $wpdb; |
2456 |
|
2457 | $object_types = is_array($taxonomy->object_type) ? $taxonomy->object_type : array($taxonomy->object_type); |
2458 | $object_types = esc_sql($object_types); |
2459 |
|
2460 | foreach ( (array) $terms as $term ) { |
2461 | $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 ) ); |
2462 | do_action( 'edit_term_taxonomy', $term, $taxonomy ); |
2463 | $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); |
2464 | do_action( 'edited_term_taxonomy', $term, $taxonomy ); |
2465 | } |
2466 | } |
2467 |
|
2468 |
|
2469 | /** |
2470 | * Generates a permalink for a taxonomy term archive. |
2471 | * |