Can someone provide normal examples of “adding acf data to new generated post”?
I don’t understand how exactly we can add our acf data to complex repeaters field logic.
For example, can I simply add like this:
add_row('field_5572bef008ebf', array(
'field_55bcef9fcc94c' => 'someval',
'field_5572ed3fefcb8' => array(
'field_55c71cf24dd7f' => 'someval',
'field_56a74edfa0efe' => array(
'field_56a74edfa2efz' => 'someval',
'field_56a75edfa4eff' => array(
'field_56a74sdfa2efi' => 'someval'
)
),
'field_5572ee5befcba' => 'someval',
'field_55b90e5ca1cdf' => 'someval',
'field_55b90b13a1cde' => 'someval'
)
), $post_id);
I’m adding acf data after post was generated, and have status ‘draft’.
Hi @infogoldweb-lt
You can take a look how to update a field here: http://www.advancedcustomfields.com/resources/update_field/#usage. I believe it works for a newly generated post too.
You can also check the structure of the repeater by creating a post with the repeater and show it using this code:
echo "<pre>";
print_r(get_field('repeater_field_name'));
echo "</pre>";
I hope this helps.
Solved with your provided explanation. Thanks James!