site_status_should_suggest_persistent_object_cache
云策文档标注
概述
本文档介绍 site_status_should_suggest_persistent_object_cache 过滤器,用于控制是否建议使用持久对象缓存,并允许绕过默认的阈值检查逻辑。
关键要点
- 过滤器名称:site_status_should_suggest_persistent_object_cache
- 主要功能:通过返回布尔值或 null 来覆盖默认建议逻辑,决定是否推荐使用持久对象缓存
- 参数:$suggest(布尔值或 null),默认值为 null,用于短路方法
- 相关函数:WP_Site_Health::should_suggest_persistent_object_cache()
- 引入版本:WordPress 6.1.0
代码示例
/**
* Opt out for suggesting the persistent object cache
*/
add_filter( 'site_status_should_suggest_persistent_object_cache', '__return_false' );注意事项
使用此过滤器可以完全控制建议逻辑,例如通过返回 false 来禁用持久对象缓存的建议。
原文内容
Filters whether to suggest use of a persistent object cache and bypass default threshold checks.
Description
Using this filter allows to override the default logic, effectively short-circuiting the method.
Parameters
$suggestbool|null-
Boolean to short-circuit, for whether to suggest using a persistent object cache.
Default null.
Source
$short_circuit = apply_filters( 'site_status_should_suggest_persistent_object_cache', null );
Changelog
| Version | Description |
|---|---|
| 6.1.0 | Introduced. |
Skip to note 2 content
B.
You can disable the suggestion of persistent object cache with this filter:
/** * Opt out for suggesting the persistent object cache */ add_filter( 'site_status_should_suggest_persistent_object_cache', '__return_false' );