customize_value_{$id_base}
云策文档标注
概述
customize_value_{$id_base} 是一个 WordPress 过滤器钩子,用于过滤非 theme_mod 或 option 类型的 Customize 设置值。它允许开发者在设置值被获取时进行自定义处理。
关键要点
- 钩子名称中的 $id_base 是设置名称的基础 slug,来自 $this->id_data['base']。
- 适用于非 theme_mod 或 option 的 Customize 设置,theme_mod 或 option 类型设置应使用其他对应钩子。
- 参数包括 $default_value(默认值)和 $setting(WP_Customize_Setting 实例)。
- 在 WP_Customize_Custom_CSS_Setting::value() 和 WP_Customize_Setting::value() 中被使用。
- 从 WordPress 3.4.0 版本引入,4.6.0 版本添加了 $setting 作为第二个参数。
原文内容
Filters a Customize setting value not handled as a theme_mod or option.
Description
The dynamic portion of the hook name, $id_base, refers to the base slug of the setting name, initialized from $this->id_data['base'].
For settings handled as theme_mods or options, see those corresponding functions for available hooks.
Parameters
$default_valuemixed-
The setting default value. Default empty.
$settingWP_Customize_Setting-
The setting instance.
Source
$value = apply_filters( "customize_value_{$id_base}", $value, $this );