函数文档

clean_page_cache()

💡 云策文档标注

概述

clean_page_cache() 函数用于清理缓存中指定页面ID的页面数据,包括关联的'all_page_ids'和'get_pages'缓存。该函数自 WordPress 3.4.0 起已被弃用,建议使用 clean_post_cache() 替代。

关键要点

  • 函数功能:清理缓存中匹配指定页面ID的页面数据,并清除相关缓存项。
  • 参数:$id(整数,必需),表示要清理的页面ID。
  • 弃用状态:自 WordPress 3.4.0 起弃用,应改用 clean_post_cache() 函数。
  • 相关函数:clean_post_cache() 用于清理帖子缓存,_deprecated_function() 用于标记弃用函数。

代码示例

function clean_page_cache( $id ) {
    _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' );
    clean_post_cache( $id );
}

注意事项

  • 此函数已弃用,新代码中不应使用,以避免兼容性问题。
  • 清理缓存可能影响性能,建议在必要时调用。

📄 原文内容

Will clean the page in the cache.

Description

Clean (read: delete) page from cache that matches $id. Will also clean cache associated with ‘all_page_ids’ and ‘get_pages’.

See also

Parameters

$idintrequired
Page ID to clean

Source

function clean_page_cache( $id ) {
	_deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' );

	clean_post_cache( $id );
}

Changelog

Version Description
3.4.0 Deprecated. Use clean_post_cache
2.0.0 Introduced.