created_term
Action HookDescription
Fires after a new term is created, and after the term cache has been cleaned. The {@see 'created_$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 | 2721 |
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 created_term
add_action('created_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:2721
- How this hook is used in WordPress core
<?php
2716 * @param int $term_id Term ID.
2717 * @param int $tt_id Term taxonomy ID.
2718 * @param string $taxonomy Taxonomy slug.
2719 * @param array $args Arguments passed to wp_insert_term().
2720 */
2721 do_action( 'created_term', $term_id, $tt_id, $taxonomy, $args );
2722
2723 /**
2724 * Fires after a new term in a specific taxonomy is created, and after the term
2725 * cache has been cleaned.
2726 *
PHP Documentation
<?php
/**
* Fires after a new term is created, and after the term cache has been cleaned.
*
* The {@see 'created_$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.