delete_term
Action HookDescription
Fires after a term is deleted from the database and the cache is cleaned. The {@see 'delete_$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 | 2206 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$term
|
Term ID. |
int
|
$tt_id
|
Term taxonomy ID. |
string
|
$taxonomy
|
Taxonomy slug. |
WP_Term
|
$deleted_term
|
Copy of the already-deleted term. |
array
|
$object_ids
|
List of term object IDs. |
Usage Examples
Basic Usage
<?php
// Hook into delete_term
add_action('delete_term', 'my_custom_function', 10, 5);
function my_custom_function($term, $tt_id, $taxonomy, $deleted_term, $object_ids) {
// Your custom code here
}
Source Code Context
wp-includes/taxonomy.php:2206
- How this hook is used in WordPress core
<?php
2201 * @param int $tt_id Term taxonomy ID.
2202 * @param string $taxonomy Taxonomy slug.
2203 * @param WP_Term $deleted_term Copy of the already-deleted term.
2204 * @param array $object_ids List of term object IDs.
2205 */
2206 do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term, $object_ids );
2207
2208 /**
2209 * Fires after a term in a specific taxonomy is deleted.
2210 *
2211 * The dynamic portion of the hook name, `$taxonomy`, refers to the specific
PHP Documentation
<?php
/**
* Fires after a term is deleted from the database and the cache is cleaned.
*
* The {@see 'delete_$taxonomy'} hook is also available for targeting a specific
* taxonomy.
*
* @since 2.5.0
* @since 4.5.0 Introduced the `$object_ids` argument.
*
* @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.
*/
Quick Info
- Hook Type: Action
- Parameters: 5
- File: wp-includes/taxonomy.php
Related Hooks
Related hooks will be displayed here in future updates.