WP_Customize_Widgets::get_setting_type() WordPress Method

The WP_Customize_Widgets::get_setting_type() method is used to get the setting type for a given widget setting.

WP_Customize_Widgets::get_setting_type( string $setting_id ) #

Retrieves the widget setting type given a setting ID.


Parameters

$setting_id

(string)(Required)Setting ID.


Top ↑

Return

(string|void) Setting type.


Top ↑

Source

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

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


Top ↑

Changelog

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

Show More