> 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/functions/is_acpt_field_visible.md).

# is\_acpt\_field\_visible

Check if a field is visible based on its value

Check whether a field is visible based on its conditional rendering rules and current value.

### Usage

```php
if (is_acpt_field_visible([
    'post_id'    => 123,
    'box_name'   => 'box',
    'field_name' => 'field',
])) {
    // render the field
}
```

### Parameters

| Parameter              | Type              | Required                 | Description                                                                                    |
| ---------------------- | ----------------- | ------------------------ | ---------------------------------------------------------------------------------------------- |
| `post_id`              | integer           | Conditional              | The post ID                                                                                    |
| `term_id`              | integer           | Conditional              | The term ID                                                                                    |
| `user_id`              | integer           | Conditional              | The user ID                                                                                    |
| `comment_id`           | integer           | Not currently functional | Accepted, but see warning below                                                                |
| `wc_product_attribute` | integer           | Conditional              | The WooCommerce product attribute ID                                                           |
| `option_page`          | string            | Conditional              | The option page slug                                                                           |
| `box_name`             | string            | Required                 | The meta box name                                                                              |
| `field_name`           | string            | Required                 | The field name                                                                                 |
| `parent_field_name`    | string            | Optional                 | The parent field name — required when checking a nested Repeater or Flexible Content field     |
| `index`                | string \| integer | Optional                 | Zero-based row index — required when checking a nested Repeater or Flexible Content field      |
| `block_name`           | string            | Optional                 | The parent block name — required when checking a field nested inside a Flexible Content block  |
| `block_index`          | string \| integer | Optional                 | Zero-based block index — required when checking a field nested inside a Flexible Content block |
| `with_context`         | boolean           | Optional                 | Evaluate the field's raw value with `{before, value, after}` context applied                   |

Exactly one of `post_id`, `term_id`, `user_id`, `option_page`, or `wc_product_attribute` must be provided to identify the location.

{% hint style="warning" %}
`comment_id` is accepted without a validation error, but is currently **not** wired to any location resolution in this function.
{% endhint %}

### Return

| Type   | Description                                                                   |
| ------ | ----------------------------------------------------------------------------- |
| `bool` | `true` if the field passes its visibility conditions, `false` if it is hidden |
