delete_term
Fires after a term is deleted from the database and the cache is cleaned.
The delete_(taxonomy) hook is also available for targeting a specific taxonomy.
Usage
add_action( 'delete_term', 'wp_kama_delete_term_action', 10, 5 ); /** * Function for `delete_term` action-hook. * * @param int $term Term ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * @param WP_Term $deleted_term Copy of the already-deleted term. * @param array $object_ids List of term object IDs. * * @return void */ function wp_kama_delete_term_action( $term, $tt_id, $taxonomy, $deleted_term, $object_ids ){ // action... }
- $term(int)
- Term ID.
- $tt_id(int)
- Term taxonomy ID.
- $taxonomy(string)
- Taxonomy slug.
- $deleted_term(WP_Term)
- Copy of the already-deleted term.
- $object_ids(array)
- List of term object IDs.
Changelog
Since 2.5.0 | Introduced. |
Since 4.5.0 | Introduced the $object_ids argument. |
Where the hook is called
delete_term
wp-includes/taxonomy.php 2194
do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term, $object_ids );
Where the hook is used in WordPress
wp-includes/default-filters.php 441
add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 );