wp_is_recovery_mode()
云策文档标注
概述
wp_is_recovery_mode() 函数用于检测 WordPress 是否处于恢复模式。在此模式下,导致白屏死机(WSOD)的插件或主题会被暂停,以帮助站点从错误中恢复。
关键要点
- 函数返回布尔值,表示恢复模式是否激活
- 内部调用 wp_recovery_mode()->is_active() 来检查状态
- 恢复模式旨在自动处理插件或主题引起的致命错误
代码示例
$err = "Some plugin or theme are causing WSOD, Contact webmaster!";
$ok = "No problem !";
echo wp_is_recovery_mode() ? "$err" : "$ok";
原文内容
Determines whether WordPress is in Recovery Mode.
Description
In this mode, plugins or themes that cause WSODs will be paused.
Source
function wp_is_recovery_mode() {
return wp_recovery_mode()->is_active();
}
Changelog
| Version | Description |
|---|---|
| 5.2.0 | Introduced. |
Skip to note 2 content
BlackSwanDev
When debugging, use these can be handful when you want to warn users that site is experiencing some problems !
$err = "Some plugin or theme are causing WSOD, Contact webmaster!"; $ok = "No problem !"; echo wp_is_recovery_mode() ? "$err" : "$ok";