Home › Forums › General Issues › How to fill group field with data › Reply To: How to fill group field with data
When updating a field that does not exist yet you need to use the field key rather than the field name.
When dealing with a group field, it can only have one row so I would bypass the loop and add_row and to
$value = array(
// sub field key/value pairs
'field_12345' => 'value 1',
'field_34567' => 'value 2',
// etc....
);
update_field('field_xyz123', $value, $post_id);
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.