Action hook 'deleted_term_taxonomy'

in WP Core File wp-includes/taxonomy.php at line 2182

View Source

deleted_term_taxonomy

Action Hook
Description
Fires immediately after a term taxonomy ID is deleted.

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Action
Line Number 2182

Hook Parameters

Type Name Description
int $tt_id Term taxonomy ID.

Usage Examples

Basic Usage
<?php
// Hook into deleted_term_taxonomy
add_action('deleted_term_taxonomy', 'my_custom_function', 10, 1);

function my_custom_function($tt_id) {
    // Your custom code here
}

Source Code Context

wp-includes/taxonomy.php:2182 - How this hook is used in WordPress core
<?php
2177  	 *
2178  	 * @since 2.9.0
2179  	 *
2180  	 * @param int $tt_id Term taxonomy ID.
2181  	 */
2182  	do_action( 'deleted_term_taxonomy', $tt_id );
2183  
2184  	// Delete the term if no taxonomies use it.
2185  	if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term ) ) ) {
2186  		$wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) );
2187  	}

PHP Documentation

<?php
/**
	 * Fires immediately after a term taxonomy ID is deleted.
	 *
	 * @since 2.9.0
	 *
	 * @param int $tt_id Term taxonomy ID.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.