Home › Forums › Add-ons › Repeater Field › How to add new row in repeater under some group programatically › Reply To: How to add new row in repeater under some group programatically
I have found a solution:
We can use update_field to add new rows to a repeater inside a group.
1. Get all values of the fields inside that group
2. Manipulate the resulting array adding new values in the repeater’s array
3. Update the group field.
It works even if the repeater never had any rows.
$pachet_8 = get_field("pachet_8", $post_id);
$pachet_8['rata_3']['plati'][] = array(
"suma" => 1001,
"data_platii" => "10.10.2018"
);
update_field("pachet_8", $pachet_8, $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.