Fires after a term in a specific taxonomy is deleted.


do_action( 'delete_<taxonomy>', (int) $term, (int) $tt_id, (mixed) $deleted_term, (array) $object_ids ); 

The dynamic portion(s) of the hook name refer to the specific taxonomy the term belonged to.

Parameters (4)

0. $term (int)
The term.
1. $tt_id (int)
Term taxonomy ID.
2. $deleted_term (mixed)
Copy of the already-deleted term, in the form specified by the parent function. WP_Error otherwise.
3. $object_ids (array)
List of term object IDs.


To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'delete_{$taxonomy}', $term, $tt_id, $deleted_term, $object_ids ); 
The following example is for adding a hook callback.
  1. // define the delete_<taxonomy> callback 
  2. function action_delete_taxonomy( $term, $tt_id, $deleted_term, $object_ids ) { 
  3. // make action magic happen here... 
  4. }; 
  6. // add the action 
  7. add_action( "delete_{$taxonomy}", 'action_delete_taxonomy', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( "delete_{$taxonomy}", 'action_delete_taxonomy', 10, 4 ); 

Defined (1)

The action is defined in the following location(s).

  1. do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids );