Home › Forums › Bug Reports › Bug FILE field and IMAGE field in front-end bug in 5.6.0 › Reply To: Bug FILE field and IMAGE field in front-end bug in 5.6.0
Elliot’s answer for this problem :
I’ve just done some testing with the acf_form() function and basic uploader, but cannot replicate any issue with the uploaded image/file.
The attachment uploaded is correctly connected to the new post created by the acf_form()
It may be possible that another plugin is causing the conflict.
If you are able to debug this issue, that would be great.
Both the image and file fields use the update_value() function found within the file ‘includes/fields/class-acf-field-file.php’ line 347.
This function is called right before the value (postmeta) is saved into the DB .
You can see hat on line 374, the function acf_connect_attachment_to_post() is called to connect the attachment with the post.
– This has not changed from 5.5.14 to 5.6.0, however, you should start here in your debugging to test what is going wrong in this function.
After desactivating all my plugins the problem is still there.
For the moment, to work around the problem I added in my
add_action(‘acf/save_post’, ‘my_acf_save_post’, 20);
the following actions:
$my_file_id = $_POST[‘acf’][‘field_57th9069b8012’];
update_field (‘post_my_file_field’, $my_file_id, $post_id);
Not a good solution but it works for me ;o)
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’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.