Home › Forums › Backend Issues (wp-admin) › Repeater field returning repeater count until post is saved via admin screen › Reply To: Repeater field returning repeater count until post is saved via admin screen
Dumping out the meta_data for one of these post reveals that when the post is saved via the admin save button, it has a [_primary] => array ([0] => field_key).
When dumping out the meta for a post that has only had its repeater field sub fields saved, it is missing the [_primary] key in the meta array.
I guess I maybe able to resolve this (glitch, bug, or miss understanding of how ACF update_sub_field() works) by adding that meta value and array with key, programatically.
FIXED
Add this after the update_sub_field() function is called appears to fix this issue.
update_post_meta($submission_id, '_primary','field_559eee03f62d2');
The repeater name is “primary” and ACF needs the “_primary” meta to hold the “primary” field key ID. It would be nice if this was done via update_sub_field() but apparently it isn’t.
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.