delete_(taxonomy) хук-событиеWP 2.3.0

Fires after a term in a specific taxonomy is deleted.

The dynamic portion of the hook name, $taxonomy, refers to the specific taxonomy the term belonged to.

Possible hook names include:

Использование

add_action( 'delete_(taxonomy)', 'wp_kama_delete_taxonomy_action', 10, 4 );

/**
 * Function for `delete_(taxonomy)` action-hook.
 * 
 * @param int     $term         Term ID.
 * @param int     $tt_id        Term taxonomy ID.
 * @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_taxonomy_action( $term, $tt_id, $deleted_term, $object_ids ){

	// action...
}
$term(int)
Term ID.
$tt_id(int)
Term taxonomy ID.
$deleted_term(WP_Term)
Copy of the already-deleted term.
$object_ids(массив)
List of term object IDs.

Список изменений

С версии 2.3.0 Введена.
С версии 4.5.0 Introduced the $object_ids argument.

Где вызывается хук

wp_delete_term()
delete_(taxonomy)
wp-includes/taxonomy.php 2151
do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids );

Где используется хук в WordPress

wp-admin/includes/class-wp-site-icon.php 73
add_action( 'delete_attachment', array( $this, 'delete_attachment_data' ) );
wp-includes/blocks/calendar.php 151
add_action( 'delete_post', 'block_core_calendar_update_has_published_post_on_delete' );
wp-includes/blocks/site-logo.php 181
add_action( "delete_option_theme_mods_$theme", '_delete_site_logo_on_remove_theme_mods' );
wp-includes/blocks/site-logo.php 201
add_action( 'delete_option_site_logo', '_delete_custom_logo_on_remove_site_logo' );
wp-includes/default-filters.php 529
add_action( 'delete_post', 'delete_get_calendar_cache' );
wp-includes/default-filters.php 524
add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
wp-includes/default-filters.php 438
add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );
wp-includes/default-filters.php 436
add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 );
wp-includes/default-filters.php 435
add_action( 'delete_post', '_wp_delete_post_menu_item' );
wp-includes/default-filters.php 432
add_action( 'delete_expired_transients', 'delete_expired_transients' );
wp-includes/default-filters.php 128
add_filter( 'delete_term_metadata_by_mid', 'wp_check_term_meta_support_prefilter' );
wp-includes/default-filters.php 125
add_filter( 'delete_term_metadata', 'wp_check_term_meta_support_prefilter' );
wp-includes/ms-default-filters.php 64
add_filter( 'delete_blog_metadata', 'wp_check_site_meta_support_prefilter' );
wp-includes/ms-default-filters.php 67
add_filter( 'delete_blog_metadata_by_mid', 'wp_check_site_meta_support_prefilter' );
wp-includes/ms-default-filters.php 79
add_action( 'delete_post', '_update_blog_date_on_post_delete' );
wp-includes/nav-menu.php 1148
remove_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );
wp-includes/nav-menu.php 1160
add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' );