WP_Customize_Setting::get_root_value()protectedWP 4.4.0

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

Метод класса: WP_Customize_Setting{}

Хуков нет.

Возвращает

Разное.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_root_value( $default_value );
$default_value(разное)
Value to return if root does not exist.
По умолчанию: null

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

С версии 4.4.0 Введена.

Код WP_Customize_Setting::get_root_value() WP 6.5.2

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