customize_value_{$this->id_data[‘base’]} WordPress Filter Hook

The customize_value_{$this->id_data[‘base’]} hook is used to modify the value of a setting returned by the WordPress Customizer. This hook is triggered when the Customizer retrieves a setting's value, and allows you to modify the value before it is passed back to the Customizer. This hook is particularly useful for settings that are stored as serialized arrays or objects, as it allows you to modify the individual values within the array or object. To use this hook, you must first register the setting with the WordPress Customizer. Once the setting is registered, you can then hook into the customize_value_{$this->id_data[‘base’]} hook and modify the setting's value. Here is an example of how to register a setting and hook into the customize_value_{$this->id_data[‘base’]} hook: function my_customizer_register( $wp_customize ) { // Register a new setting with the WordPress Customizer $wp_customize->add_setting( 'my_setting', array( 'default' => 'default value', 'transport' => 'refresh', ) ); // Hook into the customize_value_{$this->id_data[‘base’]} hook and modify the setting's value function my_customizer_value_modifier( $value ) { // Modify the setting's value return 'modified value'; } add_filter( "customize_value_{$this->id_data[‘base’]}", 'my_customizer_value_modifier' ); } add_action( 'customize_register', 'my_customizer_register' );

apply_filters( "customize_value_{$this->id_data['base']}", mixed $default ) #

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


Description

The dynamic portion of the hook name, $this->id_date['base'], refers to the base slug of the setting name.

For settings handled as theme_mods or options, see those corresponding functions for available hooks.


Top ↑

Parameters

$default

(mixed)The setting default value. Default empty.


Top ↑

Source

File: wp-includes/class-wp-customize-setting.php

View on Trac


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.