Automattic\WooCommerce\Admin\API

OnboardingPlugins::can_install_plugins()publicWC 1.0

Check whether the current user has permission to install plugins

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

Хуков нет.

Возвращает

WP_Error|true|false.

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

$OnboardingPlugins = new OnboardingPlugins();
$OnboardingPlugins->can_install_plugins();

Код OnboardingPlugins::can_install_plugins() WC 9.3.3

public function can_install_plugins() {
	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;
}