Automattic\WooCommerce\Admin\API

OnboardingTasks::hide_task_list_permission_check()publicWC 1.0

Check if a given request has permission to hide task lists.

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

Хуков нет.

Возвращает

WP_Error|true|false.

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

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

Код OnboardingTasks::hide_task_list_permission_check() WC 9.4.2

public function hide_task_list_permission_check( $request ) {
	if ( ! current_user_can( 'manage_woocommerce' ) ) {
		return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you are not allowed to hide task lists.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
	}

	return true;
}