Hello, first off: great plugin!
Here is my issue:
I have a front-end form to create a user and pass the form infos to it.
The only struggle I have is with the image-file I want to pass to an image-field.
Usually I would use something like $_FILES['my_image']
in a wp_handle_upload() function to get the attachment ID after it’s uploaded. But $_POST['acf']['field_5819d5e12d2d0']
gives me an error “Warning: Illegal string offset ‘size'” and $_FILES['acf']['field_5819d5e12d2d0']
gives “Notice: Undefined index: field_5819d5e12d2d0”.
Even without any extra function, the file is still uploading to the media library. So is there a way to get the attachment ID of the file after it’s uploaded? Some value that is returned after the upload?
if field_5819d5e12d2d0
is the field key of the image field then the value of $_POST['acf']['field_5819d5e12d2d0']
is the attachment ID.
Hello John, thanks for your hint.
After I read your answer, I realized that I tried to get the attachment ID in a pre_save_post
action while the files wasn’t uploaded at this point.