I’m glad that worked for you.
Regarding your questions:
1. ACF saves two entries in the database when you save a custom field, the value and the reference. This mostly happens when you save a post from the backend. The value looks like this:
field_name : field value
While the reference looks like this:
_field_name : field_1234567890abc
The reference is important for ACF to know which field you want to save/update exactly. That’s because you can have multiple fields with the same name on a single page, but you can’t have multiple fields with the same field key.
When you create a post programmatically, the reference is not created automatically. So, you need to use the field key instead of the field name. That way ACF know which field you want to save/update.
2. Yes, the
add_row() should be working. I think the issue is the same with the first answer. If you want, you can try to use that function again and use the field key instead of the field name for the parent selector.
I showed you the
update_field() function because it’s the most basic one and it should show the saving process more clearly.
I hope this helps 🙂
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!