edited_term_taxonomy
云策文档标注
概述
edited_term_taxonomy 是一个 WordPress 动作钩子,在 term-taxonomy 关系更新后立即触发。它主要用于在分类术语更新时执行自定义操作。
关键要点
- 触发时机:在 term-taxonomy 关系更新后立即执行。
- 参数:$tt_id(Term taxonomy ID)、$taxonomy(Taxonomy slug)、$args(传递给 wp_update_term() 的参数数组)。
- 用途:常用于更新术语计数或执行其他与分类相关的操作。
- 相关函数:与 _update_post_term_count()、_update_generic_term_count() 和 wp_update_term() 关联。
代码示例
do_action( 'edited_term_taxonomy', $tt_id, $taxonomy, $args );注意事项
- 参数 $args 在 WordPress 6.1.0 版本中添加,包含 alias_of、description、parent 和 slug 等字段。
- 该钩子自 WordPress 2.9.0 版本引入,是核心 taxonomy 系统的一部分。
原文内容
Fires immediately after a term-taxonomy relationship is updated.
Parameters
$tt_idint-
Term taxonomy ID.
$taxonomystring-
Taxonomy slug.
$argsarray-
Arguments passed to wp_update_term() .
More Arguments from wp_update_term( … $args )
Array of arguments for updating a term.
alias_ofstringSlug of the term to make this term an alias of.
Accepts a term slug.descriptionstringThe term description.parentintThe id of the parent term. Default 0.slugstringThe term slug to use.
Source
do_action( 'edited_term_taxonomy', $tt_id, $taxonomy, $args );