Automattic\WooCommerce\Admin\API

Marketing::get_recommended_plugins_permissions_check()publicWC 1.0

Check whether a given request has permission to install plugins.

{} Это метод класса: Marketing{}

Хуков нет.

Возвращает

WP_Error|true|false.

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

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

Код Marketing::get_recommended_plugins_permissions_check() WC 6.6.1

public function get_recommended_plugins_permissions_check( $request ) {
	if ( ! current_user_can( 'install_plugins' ) ) {
		return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
	}

	return true;
}