Home › Forums › Add-ons › Repeater Field › Add repeater row data via PHP – Issue when there is no data › Reply To: Add repeater row data via PHP – Issue when there is no data
Ok finally figured this out (documentation isn’t very clear on this one)
If you have zero rows to start with you need to do this:
$field_key = “field_5657dffe586cc”;
$value = get_field($field_key, ‘user_24’);
$value[] = array(“career_enjoyment_id” => “Foo”, “career_enjoyment_file” => “Bar”);
update_field( $field_key, $value, ‘user_24’ );
The $field_key is located in the wordpress posts table assigned to the main repeater. Use the ID from post_name.
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.