WP_Customize_Control::value() WordPress Method
The WP_Customize_Control::value() method is used to retrieve the value of a customizer setting for a given control. This value is then used to update the control's UI when the setting is changed. This method is useful for creating customizer controls that need to display data from other sources, such as the WordPress database. By using the WP_Customize_Control::value() method, you can ensure that your control always displays the most up-to-date data.
WP_Customize_Control::value( string $setting_key = 'default' ) #
Fetch a setting’s value.
Description
Grabs the main setting by default.
Parameters
- $setting_key
(string)(Optional)
Default value: 'default'
Return
(mixed) The requested setting's value, if the setting exists.
Source
File: wp-includes/class-wp-customize-control.php
final public function value( $setting_key = 'default' ) { if ( isset( $this->settings[ $setting_key ] ) ) { return $this->settings[ $setting_key ]->value(); } }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |