WP_Customize_Widgets::get_setting_type()protectedWP 4.2.0

Retrieves the widget setting type given a setting ID.

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

Хуков нет.

Возвращает

Строку|null. Setting type.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_setting_type( $setting_id );
$setting_id(строка) (обязательный)
Setting ID.

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

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

Код WP_Customize_Widgets::get_setting_type() WP 6.5.2

protected function get_setting_type( $setting_id ) {
	static $cache = array();
	if ( isset( $cache[ $setting_id ] ) ) {
		return $cache[ $setting_id ];
	}
	foreach ( $this->setting_id_patterns as $type => $pattern ) {
		if ( preg_match( $pattern, $setting_id ) ) {
			$cache[ $setting_id ] = $type;
			return $type;
		}
	}
}