Action hook 'create_{$taxonomy}'

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

View Source

create_{$taxonomy}

Action Hook
Description
Fires after a new term is created for a specific taxonomy. The dynamic portion of the hook name, `$taxonomy`, refers to the slug of the taxonomy the term was created for. Possible hook names include: - `create_category` - `create_post_tag`

Hook Information

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

Hook Parameters

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

Usage Examples

Basic Usage
<?php
// Hook into create_{$taxonomy}
add_action('create_{$taxonomy}', 'my_custom_function', 10, 3);

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

Source Code Context

wp-includes/taxonomy.php:2691 - How this hook is used in WordPress core
<?php
2686  	 *
2687  	 * @param int   $term_id Term ID.
2688  	 * @param int   $tt_id   Term taxonomy ID.
2689  	 * @param array $args    Arguments passed to wp_insert_term().
2690  	 */
2691  	do_action( "create_{$taxonomy}", $term_id, $tt_id, $args );
2692  
2693  	/**
2694  	 * Filters the term ID after a new term is created.
2695  	 *
2696  	 * @since 2.3.0

PHP Documentation

<?php
/**
	 * Fires after a new term is created for a specific taxonomy.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers
	 * to the slug of the taxonomy the term was created for.
	 *
	 * Possible hook names include:
	 *
	 *  - `create_category`
	 *  - `create_post_tag`
	 *
	 * @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 array $args    Arguments passed to wp_insert_term().
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.