It has to be in the way that you’re constructing the nested array. Going to be honest, I’m not exactly sure what the problem is. In your first code if you can output the array that you’ve constructed that might tell you where it’s going wrong
echo '<pre>'; print_r($data); echo '</pre>'; update_field( $field_key, $data, $post_id );
I can tell you that in your second code you have a similar problem to the first code you poasted. You are trying to add a sub row to a repeater that does not exist yet.
add_sub_row() is called before the
update_field() call that creates the repeater that you want to add the row to.
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!
© 2022 Advanced Custom Fields.