Automattic\WooCommerce\Admin\API
PaymentGatewaySuggestions::user_can_manage_woocommerce()
Check if a given request has access to manage woocommerce.
Метод класса: PaymentGatewaySuggestions{}
Хуков нет.
Возвращает
\WP_Error|true|false
.
Использование
$PaymentGatewaySuggestions = new PaymentGatewaySuggestions(); $PaymentGatewaySuggestions->user_can_manage_woocommerce();
Код PaymentGatewaySuggestions::user_can_manage_woocommerce() PaymentGatewaySuggestions::user can manage woocommerce WC 9.8.2
public function user_can_manage_woocommerce() { if ( current_user_can( 'manage_woocommerce' ) ) { return true; } return new \WP_Error( 'woocommerce_rest_invalid_user', __( 'You are not allowed to make this request.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); }