public update_item_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean | ||
$request | WP_REST_Request | Full details about the request. |
리턴 | WP_Error | boolean |
public function update_item_permissions_check($request)
{
$post = get_post($request['id']);
if ($post && !wc_rest_check_post_permissions($this->post_type, 'edit', $post->ID)) {
return new WP_Error('woocommerce_rest_cannot_edit', __('Sorry, you are not allowed to edit this resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}