钩子文档

customize_section_active

💡 云策文档标注

概述

customize_section_active 是一个 WordPress 过滤器,用于修改 WP_Customize_Section::active() 方法的返回值,控制 Customizer 部分是否在当前预览中显示为活动状态。

关键要点

  • 过滤器名称:customize_section_active
  • 参数:$active(布尔值,表示部分是否活动)和 $section(WP_Customize_Section 实例)
  • 用途:允许开发者动态调整 Customizer 部分的活动状态,基于自定义条件
  • 引入版本:WordPress 4.1.0

代码示例

$active = apply_filters( 'customize_section_active', $active, $section );

📄 原文内容

Filters response of WP_Customize_Section::active().

Parameters

$activebool
Whether the Customizer section is active.
$sectionWP_Customize_Section

Source

$active = apply_filters( 'customize_section_active', $active, $section );

Changelog

Version Description
4.1.0 Introduced.