Multi-File Upload (images) > Advanced Post Creation > ACF Gallery [RESOLVED]

Hey there. I’ve got a form that creates a post. The form has a Featured Image and a multi-file upload (jpg, jpeg only). Within the Post Creation feed I’ve mapped the Featured Image to the posts Featured Image. Upon submission that works great.

I also map the acf gallery “image_gallery” field to my apc_meda merge tag
{apc_media:7:ids}

Upon submission all the images end up in the media gallery but only the first image uploaded via multi-file upload is added to the gallery. If I upload 5 images, the first one ends up in the post in the gallery field.

I believe the ACF field stores and array of IDs so not sure why the others are being missed. Anyone have any experience with this? Any help is appreciated.

thanks!

I solved this issue. Posting there in case anyone needs it: Be sure to update your form ID and field IDS.

// this function attaches the gallery images in the form to the post ACF gallery
add_action( 'gform_advancedpostcreation_post_after_creation_10', 'apc_update_gallery', 10, 4 );
function apc_update_gallery( $post_id, $feed, $entry, $form ) {
  
    // gravity forms multi-file upload field ID
    $gf_images_id = 7;

    // I pass the {apc_media:7:ids} to a custom field called "apc_image_list"
    // in the Advanced Post Creation feed which 
    // runs after the images are uploaded so we know the ids. 
    // The issue is that the merge tag above pass a string of 
    // comma demimited values in an array. Weird. 
    // So. I have to get the first array value and explode it. 
    $apc_str = get_post_meta( $post_id, "apc_image_list");
    $apc_arr = explode(',', $apc_str[0]);

    if(count($apc_arr)) {

        // get the ACF Gallery Field Key
        $field = 'field_5b96c3d8047f3';
        update_field($field, $apc_arr, $post_id);
    }
}
2 Likes