For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

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.

Return

Type
Description

bool

true if the field passes its visibility conditions, false if it is hidden

Last updated