钩子文档

delete_{$taxonomy}

💡 云策文档标注

概述

delete_{$taxonomy} 是一个 WordPress 动作钩子,在特定分类法中的术语被删除后触发。它允许开发者在术语删除后执行自定义操作。

关键要点

  • 钩子名称是动态的,$taxonomy 部分替换为具体的分类法名称,例如 delete_category 或 delete_post_tag。
  • 传递的参数包括术语 ID、术语分类法 ID、已删除术语的副本和术语对象 ID 列表。
  • 此钩子由 wp_delete_term() 函数调用,用于从数据库中移除术语。
  • 从 WordPress 4.5.0 版本开始引入了 $object_ids 参数。

📄 原文内容

Fires after a term in a specific taxonomy is deleted.

Description

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

Possible hook names include:

  • delete_category
  • delete_post_tag

Parameters

$termint
Term ID.
$tt_idint
Term taxonomy ID.
$deleted_termWP_Term
Copy of the already-deleted term.
$object_idsarray
List of term object IDs.

Source

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

Changelog

Version Description
4.5.0 Introduced the $object_ids argument.
2.3.0 Introduced.