I’ve just tested it on my installation and it was working on my drafted custom post type, both the add_row() and get_field() functions.
Did you add the new post programmatically? If you did, it’s possible that your post doesn’t have the repeater value in the database yet. Keep in mind that the add_row() function will only add a row to an existing repeater. I think you can use the update_field to add an empty value. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/update_field/.
It’s because ACF will show the repeater field based on your field group setting, but it still has no initial value in the database. It will prevent the add_row() function to add the row because it can’t find it.
Have you tried the update_field() function instead?
Hey again, no go on that one – failed like add row on the unpublished ones.
What I have ended up doing is manually inserting the fields key (getting the acf field key from the database and not hardcoding it) into the meta posts table if its missing and then importing my repeater data – this works fine.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future. https://t.co/HahJUCcyH4