Home › Forums › ACF PRO › Adding repeater items inside of Flexible Content Field using PHP Script › Reply To: Adding repeater items inside of Flexible Content Field using PHP Script
You’ll need to combine the one for the flexible content row with the one for the repeater row just above it.
$field_key = "flexible_field";
$value = get_field($field_key);
$value[] = array(
"sub_field_1" => "Foo1",
"sub_field_2" => "Bar1",
"repeater_field" => array(
array(
'repeater_sub_1' => 'value',
'repeater_sub_2' => 'value'
)
),
"acf_fc_layout" => "layout_1_name"),
;
update_field( $field_key, $value, $post_id );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.