Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_insert_term_duplicate_term_check

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

Line Code
2382       *
2383       * @since 5.1.0
2384       *
2385       * @param object $duplicate_term Duplicate term row from terms table, if found.
2386       * @param string $term           Term being inserted.
2387       * @param string $taxonomy       Taxonomy name.
2388       * @param array  $args           Term arguments passed to the function.
2389       * @param int    $tt_id          term_taxonomy_id for the newly created term.
2390       */
2391      $duplicate_term = apply_filters( 'wp_insert_term_duplicate_term_check', $duplicate_term, $term, $taxonomy, $args, $tt_id );
2392
2393      if ( $duplicate_term ) {
2394           $wpdb->delete( $wpdb->terms, array( 'term_id' => $term_id ) );
2395           $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) );
2396
2397           $term_id = (int) $duplicate_term->term_id;
2398           $tt_id   = (int) $duplicate_term->term_taxonomy_id;
2399
2400           clean_term_cache( $term_id, $taxonomy );