WP_Customize_Widgets::get_setting_type()protectedWP 4.2.0

Retrieves the widget setting type given a setting ID.

Method of the class: WP_Customize_Widgets{}

No Hooks.

Return

String|null. Setting type.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_setting_type( $setting_id );
$setting_id(string) (required)
Setting ID.

Changelog

Since 4.2.0 Introduced.

WP_Customize_Widgets::get_setting_type() code 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;
		}
	}
}