create_term
Fires immediately after a new term is created, before the term cache is cleaned.
The create_(taxonomy) hook is also available for targeting a specific taxonomy.
Usage
add_action( 'create_term', 'wp_kama_create_term_action', 10, 4 );
/**
* Function for `create_term` action-hook.
*
* @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().
*
* @return void
*/
function wp_kama_create_term_action( $term_id, $tt_id, $taxonomy, $args ){
// action...
}
- $term_id(int)
- Term ID.
- $tt_id(int)
- Term taxonomy ID.
- $taxonomy(string)
- Taxonomy slug.
- $args(array)
- Arguments passed to wp_insert_term().
Changelog
| Since 2.3.0 | Introduced. |
| Since 6.1.0 | The $args parameter was added. |
Where the hook is called
create_term
wp-includes/taxonomy.php 2677
do_action( 'create_term', $term_id, $tt_id, $taxonomy, $args );