WP_Customize_Setting::check_capabilities()publicWP 3.4.0

Validate user capabilities whether the theme supports the setting.

Method of the class: WP_Customize_Setting{}

No Hooks.

Return

true|false. False if theme doesn't support the setting or user can't change setting, otherwise true.

Usage

$WP_Customize_Setting = new WP_Customize_Setting();
$WP_Customize_Setting->check_capabilities();

Changelog

Since 3.4.0 Introduced.

WP_Customize_Setting::check_capabilities() code WP 6.5.2

final public function check_capabilities() {
	if ( $this->capability && ! current_user_can( $this->capability ) ) {
		return false;
	}

	if ( $this->theme_supports && ! current_theme_supports( ...(array) $this->theme_supports ) ) {
		return false;
	}

	return true;
}