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

get_acpt_child_field

Fetch a nested field value from a Repeater field

Fetch a nested field value from a Repeater field row.

Usage

$value = get_acpt_child_field([
    'post_id'           => 123,
    'box_name'          => 'box',
    'field_name'        => 'child_field',
    'parent_field_name' => 'repeater_field',
    'index'             => 0,
]);

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 child field name

parent_field_name

string

Required

The parent Repeater field name. Also accepted as parentFieldName

index

string | integer

Required

Zero-based row index. Use dot notation (e.g. 0.1) to reach a row nested inside a nested Repeater

with_context

boolean

Optional

Wrap the returned value in a {before, value, after} object

format

string

Optional

only_value (default) or complete

return

string

Optional

object (default) or raw

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

mixed

The child field value in its native PHP type

null

If the field or the row at the given index does not exist

Last updated