Automattic\WooCommerce\Admin\API
OnboardingThemes::update_item_permissions_check()
Check if a given request has access to manage themes.
Метод класса: OnboardingThemes{}
Хуков нет.
Возвращает
WP_Error|true|false
.
Использование
$OnboardingThemes = new OnboardingThemes(); $OnboardingThemes->update_item_permissions_check( $request );
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Код OnboardingThemes::update_item_permissions_check() OnboardingThemes::update item permissions check WC 9.4.2
public function update_item_permissions_check( $request ) { if ( ! current_user_can( 'switch_themes' ) ) { return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage themes.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); } return true; }