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 4 times in this file.
Line | Code |
---|---|
2457 |
|
2458 | /** |
2459 | * Fires immediately before the given terms are edited. |
2460 | * |
2461 | * @since 2.9.0 |
2462 | * |
2463 | * @param int $term_id Term ID. |
2464 | * @param string $taxonomy Taxonomy slug. |
2465 | */ |
2466 | do_action( 'edit_terms', $alias->term_id, $taxonomy ); |
2467 | $wpdb->update($wpdb->terms, compact('term_group'), array('term_id' => $alias->term_id) ); |
2468 |
|
2469 | /** |
2470 | * Fires immediately after the given terms are edited. |
2471 | * |
2472 | * @since 2.9.0 |
2473 | * |
2474 | * @param int $term_id Term ID |
2475 | * @param string $taxonomy Taxonomy slug. |
Line | Code |
2516 | } |
2517 | $term_id = (int) $wpdb->insert_id; |
2518 | } |
2519 |
|
2520 | // Seems unreachable, However, Is used in the case that a term name is provided, which sanitizes to an empty string. |
2521 | if ( empty($slug) ) { |
2522 | $slug = sanitize_title($slug, $term_id); |
2523 |
|
2524 | /** This action is documented in wp-includes/taxonomy.php */ |
2525 | do_action( 'edit_terms', $term_id, $taxonomy ); |
2526 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
2527 |
|
2528 | /** This action is documented in wp-includes/taxonomy.php */ |
2529 | do_action( 'edited_terms', $term_id, $taxonomy ); |
2530 | } |
2531 |
|
2532 | $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 ) ); |
2533 |
|
2534 | if ( !empty($tt_id) ) { |
Line | Code |
2962 | $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $args['alias_of'] ) ); |
2963 | if ( $alias->term_group ) { |
2964 | // The alias we want is already in a group, so let's use that one. |
2965 | $term_group = $alias->term_group; |
2966 | } else { |
2967 | // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. |
2968 | $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; |
2969 |
|
2970 | /** This action is documented in wp-includes/taxonomy.php */ |
2971 | do_action( 'edit_terms', $alias->term_id, $taxonomy ); |
2972 | $wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) ); |
2973 |
|
2974 | /** This action is documented in wp-includes/taxonomy.php */ |
2975 | do_action( 'edited_terms', $alias->term_id, $taxonomy ); |
2976 | } |
2977 |
|
2978 | $parsed_args['term_group'] = $term_group; |
2979 | } |
2980 |
|
Line | Code |
2999 | // If an empty slug was passed or the parent changed, reset the slug to something unique. |
3000 | // Otherwise, bail. |
3001 | if ( $empty_slug || ( $parent != $term['parent']) ) |
3002 | $slug = wp_unique_term_slug($slug, (object) $args); |
3003 | else |
3004 | return new WP_Error('duplicate_term_slug', sprintf(__('The slug “%s” is already in use by another term'), $slug)); |
3005 | } |
3006 |
|
3007 | /** This action is documented in wp-includes/taxonomy.php */ |
3008 | do_action( 'edit_terms', $term_id, $taxonomy ); |
3009 | $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); |
3010 | if ( empty($slug) ) { |
3011 | $slug = sanitize_title($name, $term_id); |
3012 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
3013 | } |
3014 |
|
3015 | /** This action is documented in wp-includes/taxonomy.php */ |
3016 | do_action( 'edited_terms', $term_id, $taxonomy ); |
3017 |
|