Action hook 'create_term'

in WP Core File wp-includes/taxonomy.php at line 2671

View Source

create_term

Action Hook
Description
Fires immediately after a new term is created, before the term cache is cleaned. The {@see 'create_$taxonomy'} hook is also available for targeting a specific taxonomy.

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Action
Line Number 2671

Hook Parameters

Type Name Description
int $term_id Term ID.
int $tt_id Term taxonomy ID.
string $taxonomy Taxonomy slug.
array $args Arguments passed to wp_insert_term().

Usage Examples

Basic Usage
<?php
// Hook into create_term
add_action('create_term', 'my_custom_function', 10, 4);

function my_custom_function($term_id, $tt_id, $taxonomy, $args) {
    // Your custom code here
}

Source Code Context

wp-includes/taxonomy.php:2671 - How this hook is used in WordPress core
<?php
2666  	 * @param int    $term_id  Term ID.
2667  	 * @param int    $tt_id    Term taxonomy ID.
2668  	 * @param string $taxonomy Taxonomy slug.
2669  	 * @param array  $args     Arguments passed to wp_insert_term().
2670  	 */
2671  	do_action( 'create_term', $term_id, $tt_id, $taxonomy, $args );
2672  
2673  	/**
2674  	 * Fires after a new term is created for a specific taxonomy.
2675  	 *
2676  	 * The dynamic portion of the hook name, `$taxonomy`, refers

PHP Documentation

<?php
/**
	 * Fires immediately after a new term is created, before the term cache is cleaned.
	 *
	 * The {@see 'create_$taxonomy'} hook is also available for targeting a specific
	 * taxonomy.
	 *
	 * @since 2.3.0
	 * @since 6.1.0 The `$args` parameter was added.
	 *
	 * @param int    $term_id  Term ID.
	 * @param int    $tt_id    Term taxonomy ID.
	 * @param string $taxonomy Taxonomy slug.
	 * @param array  $args     Arguments passed to wp_insert_term().
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 4
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.