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

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);
    }
}
1 Like