WP_Customize_Setting::get_root_value() WordPress Method

The WP_Customize_Setting::get_root_value() method is used to get the "root" value for a setting, which is the value that is stored in the database. This is different from the "current" value, which is the value that is currently being used by the setting.

WP_Customize_Setting::get_root_value( mixed $default_value = null ) #

Get the root value for a setting, especially for multidimensional ones.


Parameters

$default_value

(mixed)(Optional)Value to return if root does not exist.

Default value: null


Top ↑

Return

(mixed)


Top ↑

Source

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

	protected function get_root_value( $default_value = null ) {
		$id_base = $this->id_data['base'];
		if ( 'option' === $this->type ) {
			return get_option( $id_base, $default_value );
		} elseif ( 'theme_mod' === $this->type ) {
			return get_theme_mod( $id_base, $default_value );
		} else {
			/*
			 * Any WP_Customize_Setting subclass implementing aggregate multidimensional
			 * will need to override this method to obtain the data from the appropriate
			 * location.
			 */
			return $default_value;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.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.