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 |
---|---|
2406 |
|
2407 | /** |
2408 | * Fires immediately before the given terms are edited. |
2409 | * |
2410 | * @since 2.9.0 |
2411 | * |
2412 | * @param int $term_id Term ID. |
2413 | * @param string $taxonomy Taxonomy slug. |
2414 | */ |
2415 | do_action( 'edit_terms', $alias->term_id, $taxonomy ); |
2416 | $wpdb->update($wpdb->terms, compact('term_group'), array('term_id' => $alias->term_id) ); |
2417 |
|
2418 | /** |
2419 | * Fires immediately after the given terms are edited. |
2420 | * |
2421 | * @since 2.9.0 |
2422 | * |
2423 | * @param int $term_id Term ID |
2424 | * @param string $taxonomy Taxonomy slug. |
Line | Code |
2462 | return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); |
2463 | $term_id = (int) $wpdb->insert_id; |
2464 | } |
2465 |
|
2466 | // Seems unreachable, However, Is used in the case that a term name is provided, which sanitizes to an empty string. |
2467 | if ( empty($slug) ) { |
2468 | $slug = sanitize_title($slug, $term_id); |
2469 |
|
2470 | /** This action is documented in wp-includes/taxonomy.php */ |
2471 | do_action( 'edit_terms', $term_id, $taxonomy ); |
2472 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
2473 |
|
2474 | /** This action is documented in wp-includes/taxonomy.php */ |
2475 | do_action( 'edited_terms', $term_id, $taxonomy ); |
2476 | } |
2477 |
|
2478 | $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 ) ); |
2479 |
|
2480 | if ( !empty($tt_id) ) |
Line | Code |
2900 | $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) ); |
2901 | if ( $alias->term_group ) { |
2902 | // The alias we want is already in a group, so let's use that one. |
2903 | $term_group = $alias->term_group; |
2904 | } else { |
2905 | // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. |
2906 | $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; |
2907 |
|
2908 | /** This action is documented in wp-includes/taxonomy.php */ |
2909 | do_action( 'edit_terms', $alias->term_id, $taxonomy ); |
2910 | $wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) ); |
2911 |
|
2912 | /** This action is documented in wp-includes/taxonomy.php */ |
2913 | do_action( 'edited_terms', $alias->term_id, $taxonomy ); |
2914 | } |
2915 | } |
2916 |
|
2917 | /** |
2918 | * Filter the term parent. |
Line | Code |
2935 | // If an empty slug was passed or the parent changed, reset the slug to something unique. |
2936 | // Otherwise, bail. |
2937 | if ( $empty_slug || ( $parent != $term['parent']) ) |
2938 | $slug = wp_unique_term_slug($slug, (object) $args); |
2939 | else |
2940 | return new WP_Error('duplicate_term_slug', sprintf(__('The slug “%s” is already in use by another term'), $slug)); |
2941 | } |
2942 |
|
2943 | /** This action is documented in wp-includes/taxonomy.php */ |
2944 | do_action( 'edit_terms', $term_id, $taxonomy ); |
2945 | $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) ); |
2946 | if ( empty($slug) ) { |
2947 | $slug = sanitize_title($name, $term_id); |
2948 | $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) ); |
2949 | } |
2950 |
|
2951 | /** This action is documented in wp-includes/taxonomy.php */ |
2952 | do_action( 'edited_terms', $term_id, $taxonomy ); |
2953 |
|