Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: edit_terms

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
2271      }
2272
2273      $term_id = (int) $wpdb->insert_id;
2274
2275      // Seems unreachable. However, is used in the case that a term name is provided, which sanitizes to an empty string.
2276      if ( empty( $slug ) ) {
2277           $slug = sanitize_title( $slug, $term_id );
2278
2279           /** This action is documented in wp-includes/taxonomy.php */
2280           do_action( 'edit_terms', $term_id, $taxonomy );
2281           $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );
2282
2283           /** This action is documented in wp-includes/taxonomy.php */
2284           do_action( 'edited_terms', $term_id, $taxonomy );
2285      }
2286
2287      $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 ) );
2288
2289      if ( ! empty( $tt_id ) ) {
 
Line Code
2937
2938      /**
2939       * Fires immediately before the given terms are edited.
2940       *
2941       * @since 2.9.0
2942       *
2943       * @param int    $term_id  Term ID.
2944       * @param string $taxonomy Taxonomy slug.
2945       */
2946      do_action( 'edit_terms', $term_id, $taxonomy );
2947
2948      $data = compact( 'name', 'slug', 'term_group' );
2949
2950      /**
2951       * Filters term data before it is updated in the database.
2952       *
2953       * @since 4.7.0
2954       *
2955       * @param array  $data     Term data to be updated.