customize_value_(id_base) хук-фильтрWP 3.4.0

Filters a Customize setting value not handled as a theme_mod or option.

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.


add_filter( 'customize_value_(id_base)', 'wp_kama_customize_value_id_base_filter', 10, 2 );

 * Function for `customize_value_(id_base)` filter-hook.
 * @param mixed                $default_value The setting default value.
 * @param WP_Customize_Setting $setting       The setting instance.
 * @return mixed
function wp_kama_customize_value_id_base_filter( $default_value, $setting ){

	// filter...
	return $default_value;
The setting default value.
По умолчанию: ''
The setting instance.

Список изменений

С версии 3.4.0 Введена.
С версии 4.6.0 Added the $this setting instance as the second parameter.

Где вызывается хук

wp-includes/class-wp-customize-setting.php 768
$value = apply_filters( "customize_value_{$id_base}", $value, $this );
wp-includes/customize/class-wp-customize-custom-css-setting.php 142
$value = apply_filters( "customize_value_{$id_base}", $value, $this );

Где используется хук в WordPress

wp-includes/class-wp-customize-widgets.php 276
add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) );