Support

Account

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)