customize_panel_active
云策文档标注
概述
customize_panel_active 是一个 WordPress 过滤器钩子,用于修改 WP_Customize_Panel::active() 方法的返回值,控制 Customizer 面板的激活状态。
关键要点
- 过滤器名称:customize_panel_active
- 参数:$active(布尔值,表示面板是否激活)和 $panel(WP_Customize_Panel 实例)
- 用途:允许开发者动态调整 Customizer 面板在当前预览中的可见性
- 引入版本:WordPress 4.1.0
代码示例
$active = apply_filters( 'customize_panel_active', $active, $panel );
原文内容
Filters response of WP_Customize_Panel::active().
Parameters
$activebool-
Whether the Customizer panel is active.
$panelWP_Customize_Panel-
WP_Customize_Panel instance.
Source
$active = apply_filters( 'customize_panel_active', $active, $panel );
Changelog
| Version | Description |
|---|---|
| 4.1.0 | Introduced. |