validate_current_theme
云策文档标注
概述
validate_current_theme 是一个 WordPress 过滤器,用于控制是否验证当前激活的主题。它允许开发者通过返回布尔值来覆盖默认的验证行为。
关键要点
- 这是一个过滤器钩子,用于干预主题验证过程。
- 参数 $validate 是一个布尔值,表示是否验证主题,默认值为 true。
- 在 WordPress 2.7.0 版本中引入。
代码示例
if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) {
// 代码逻辑
}注意事项
此过滤器通常用于在特定条件下跳过主题验证,例如在安装过程中或自定义开发场景中。
原文内容
Filters whether to validate the active theme.
Parameters
$validatebool-
Whether to validate the active theme. Default true.
Source
if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) {
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |