钩子文档

update_term_count

💡 云策文档标注

概述

update_term_count 是一个 WordPress Hook,在术语计数计算后、更新到数据库前触发。它允许开发者在术语计数更新过程中执行自定义操作。

关键要点

  • 触发时机:术语计数计算完成,但尚未写入数据库时。
  • 参数:$tt_id(术语分类法 ID)、$taxonomy_name(分类法 slug)、$count(术语计数)。
  • 相关函数:_update_post_term_count() 和 _update_generic_term_count() 用于更新术语计数。
  • 版本历史:自 WordPress 6.9.0 引入。

📄 原文内容

Fires when a term count is calculated, before it is updated in the database.

Parameters

$tt_idint
Term taxonomy ID.
$taxonomy_namestring
Taxonomy slug.
$countint
Term count.

Source

do_action( 'update_term_count', $tt_id, $taxonomy->name, $count );

Changelog

Version Description
6.9.0 Introduced.