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.


Top ↑

Parameters

$setting_key

(string)(Optional)

Default value: 'default'


Top ↑

Return

(mixed) The requested setting's value, if the setting exists.


Top ↑

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();
		}
	}


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.