WP_Customize_Partial::check_capabilities() WordPress Method

The WP_Customize_Partial::check_capabilities() method is used to check if the current user has the required capabilities to edit a given partial. If the user does not have the required capabilities, the method will return false.

WP_Customize_Partial::check_capabilities() #

Checks if the user can refresh this partial.


Description

Returns false if the user cannot manipulate one of the associated settings, or if one of the associated settings does not exist.


Top ↑

Return

(bool) False if user can't edit one of the related settings, or if one of the associated settings does not exist.


Top ↑

Source

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

	final public function check_capabilities() {
		if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) {
			return false;
		}
		foreach ( $this->settings as $setting_id ) {
			$setting = $this->component->manager->get_setting( $setting_id );
			if ( ! $setting || ! $setting->check_capabilities() ) {
				return false;
			}
		}
		return true;
	}


Top ↑

Changelog

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