I am trying to update image fields within a group in ACF via the update_field function
I am successfully adding the images to the media gallery but I am having trouble getting them added to each ACF field
The following line is adding the images to the media library and returns the ID of each image
$gallery_img_id = rudr_upload_file_by_url($gallery_img["original_path"]);
Each ACF field is titled gallery_image_1, gallery_image_2, gallery_image_3 etc.
Based on what I've read from ACF documentation I should be able to create an associative array of data for each image and add them via update_field, I'm creating a blank array $gallery_data and pushing each key/value for the acf field and the attachment ID to the associative array
$acf_gallery_slug = "gallery_image_" .$counter;
$add_image = [ $acf_gallery_slug => $gallery_img_id ];
array_push($gallery_data, $add_image);
then using update_field to update each acf field
update_field('gallery', $gallery_data, $property_id);
However the fields are not getting updated, trying to figure out what I am doing wrong?
The gallery parameter in update_field is a group field in which the gallery_img_(num) fields are located/nested, and the $property_id is the id of each post I am trying to work with.