钩子文档

clean_post_cache

💡 云策文档标注

概述

clean_post_cache 是一个 WordPress 动作钩子,在给定文章的缓存被清理后立即触发。它主要用于在文章缓存清理时执行自定义操作。

关键要点

  • 这是一个动作钩子,用于在文章缓存清理后执行代码。
  • 钩子传递两个参数:文章 ID 和 WP_Post 对象。
  • 首次引入于 WordPress 2.5.0 版本。

代码示例

do_action( 'clean_post_cache', $post->ID, $post );

注意事项

  • 与 clean_post_cache() 函数相关,该函数负责清理文章缓存。
  • 常用于插件或主题开发中,以响应文章缓存的变化。

📄 原文内容

Fires immediately after the given post’s cache is cleaned.

Parameters

$post_idint
Post ID.
$postWP_Post
Post object.

Source

do_action( 'clean_post_cache', $post->ID, $post );

Changelog

Version Description
2.5.0 Introduced.