Automattic\WooCommerce\Admin\API
OnboardingPlugins::can_install_and_activate_plugins()
Check whether the current user has permission to install and activate plugins
Метод класса: OnboardingPlugins{}
Хуков нет.
Возвращает
WP_Error|true|false
.
Использование
$OnboardingPlugins = new OnboardingPlugins(); $OnboardingPlugins->can_install_and_activate_plugins();
Код OnboardingPlugins::can_install_and_activate_plugins() OnboardingPlugins::can install and activate plugins WC 9.3.1
public function can_install_and_activate_plugins() { if ( ! current_user_can( 'install_plugins' ) || ! current_user_can( 'activate_plugins' ) ) { return new WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }