WP_Customize_Widgets::get_setting_type( string $setting_id ): string|void

In this article

Retrieves the widget setting type given a setting ID.

Parameters

$setting_idstringrequired
Setting ID.

Return

string|void Setting type.

Source

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

Changelog

VersionDescription
4.2.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.