> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/developers/actions/acpt-form-authorize_field.md).

# acpt/form/authorize\_field

Allow, skip or reject a single submitted form field before it is saved

**Type:** Filter

{% hint style="info" %}
Available since ACPT 2.1.1.
{% endhint %}

Runs once for every field of a submitted front-end form, **after** validation and **before** anything is written to the database. Use it to decide, field by field, whether the current visitor may save that value.

By default the value is ACPT's own verdict: `false` when the [meta field](/permissions-manager/meta-fields-permissions.md) (or [custom content type column](/permissions-manager/custom-content-types.md)) has permissions that don't let the current user edit it, `true` otherwise.

* Return `false` to **skip** the field: its value is not saved, the rest of the form is saved normally.
* Return a `WP_Error` to **reject** the whole submission: nothing is saved and the error message is shown next to the field.

### Parameters

| Parameter  | Type             | Description                                                                                                                 |
| ---------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `$allowed` | `bool\|WP_Error` | ACPT's own verdict (see above)                                                                                              |
| `$datum`   | `array`          | The sanitized submitted value: `id`, `name`, `type`, `value`, `extra`, and the flags `isMeta`, `isPost`, `isTerm`, `isUser` |
| `$field`   | `FormFieldModel` | The form field (use `getMetaField()` to reach the linked ACPT meta field, if any)                                           |
| `$form`    | `FormModel`      | The form being submitted                                                                                                    |

**Return:** `true` to save the field, `false` to skip it, a `WP_Error` to reject the submission.

### Usage

```php
use ACPT\Core\Models\Form\FormFieldModel;
use ACPT\Core\Models\Form\FormModel;

add_filter("acpt/form/authorize_field", function($allowed, array $datum, FormFieldModel $field, FormModel $form){
    // the "price" field can only be changed by shop managers
    if ($datum['name'] === 'product_box_price' && !current_user_can('manage_woocommerce')) {
        return new WP_Error('acpt_read_only', 'You cannot change the price.');
    }

    return $allowed;
}, 10, 4);
```

{% hint style="warning" %}
Front-end forms don't hide fields the current user can't edit. A field skipped by its permissions (or by this filter returning `false`) is simply not saved.
{% endhint %}

See also [`acpt/form/authorize_submission`](/developers/actions/acpt-form-authorize_submission.md) to allow or reject the submission as a whole.
