GC_Customize_Control::check_capabilities()

最后更新于:2021-11-26 23:21:12

GC_Customize_Control::check_capabilities()

Checks if the user can use this control.

响应

(bool) False if theme doesn’t support the control or user doesn’t have the required permissions, otherwise true.

源文件

文件: gc-includes/class-gc-customize-control.php

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

		foreach ( $this->settings as $setting ) {
			if ( ! $setting || ! $setting->check_capabilities() ) {
				return false;
			}
		}

		$section = $this->manager->get_section( $this->section );
		if ( isset( $section ) && ! $section->check_capabilities() ) {
			return false;
		}

		return true;
	}