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

get_acpt_block_child_field

Fetch a field value nested inside a Flexible Content block

Fetch a single field value from within a Flexible Content block.

Usage

$value = get_acpt_block_child_field([
    'post_id'           => 123,
    'box_name'          => 'box',
    'field_name'        => 'title',
    'parent_field_name' => 'flexible_field',
    'index'             => 0,
    'block_name'        => 'text_image',
    'block_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 (also accepted as wcProductAttribute)

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 Flexible Content field name. Also accepted as parentFieldName

index

string | integer

Required

The field's index within the block

block_name

string

Optional

The parent block name. Also accepted as blockName. Use dot notation (e.g. outer.inner) for a block nested inside another block

block_index

string | integer

Optional

Zero-based index of the block within its parent field. Also accepted as blockIndex. Use dot notation (e.g. 0.1) for a nested block

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 field value in its native PHP type

null

If the field or block does not exist at the given indices

Last updated