Automattic\WooCommerce\Admin\API

Themes::upload_theme_permissions_check()publicWC 1.0

Check whether a given request has permission to edit upload plugins/themes.

Метод класса: Themes{}

Хуков нет.

Возвращает

WP_Error|true|false.

Использование

$Themes = new Themes();
$Themes->upload_theme_permissions_check( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код Themes::upload_theme_permissions_check() WC 9.3.3

public function upload_theme_permissions_check( $request ) {
	if ( ! current_user_can( 'upload_themes' ) ) {
		return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you are not allowed to install themes on this site.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
	}

	return true;
}