钩子文档

clean_term_cache

💡 云策文档标注

概述

clean_term_cache 是一个 WordPress 动作钩子,在分类法术语缓存被清理后触发,主要用于通知开发者缓存清理事件。

关键要点

  • 钩子名称:clean_term_cache
  • 触发时机:每个分类法的术语缓存清理完成后执行一次
  • 参数:$ids(术语ID数组)、$taxonomy(分类法slug)、$clean_taxonomy(布尔值,指示是否清理分类法范围的缓存)
  • 相关函数:clean_term_cache() 用于从缓存中移除所有术语ID
  • 版本历史:从 2.5.0 引入,4.5.0 添加了 $clean_taxonomy 参数

📄 原文内容

Fires once after each taxonomy’s term cache has been cleaned.

Parameters

$idsarray
An array of term IDs.
$taxonomystring
Taxonomy slug.
$clean_taxonomybool
Whether or not to clean taxonomy-wide caches

Source

do_action( 'clean_term_cache', $ids, $taxonomy, $clean_taxonomy );

Changelog

Version Description
4.5.0 Added the $clean_taxonomy parameter.
2.5.0 Introduced.