Support

Account

Home Forums Bug Reports Image attached but not showing in Uploaded to column in Media Library

Solving

Image attached but not showing in Uploaded to column in Media Library

  • I am adding an image to a post which is working great, but if I upload an image to the Media Library, then go to the post and select it with the Image ACF, it gets attached to the post, but the Media Library still shows that image as “Unattached”.

    This is a big issue when needed to go through the Media Library and get rid of content that is no longer used.

    It does work properly, however, if you, when initially creating the post, upload the image then.

    Any suggestions or ways to fix this?

  • An option might be when adding an image with the image ACF, adding it as an actual “attachment” to the post as well would be great!

  • I checked the “WYSIWIG Editor” ACF, and when using the “Media Upload” button it does more or less what I am needing the File ACF and Image ACF to do, which is add the file as an actual “attachment” to the post.

    Hope this helps with the troubleshooting and finding a possible solution.

  • Hi @whodeee

    Thanks for the bug report. Just to clarify, the image field is not correctly attaching the newly uploaded image to the current post.

    You say that it does work for a new post? But not for an existing post?

  • Hi @elliot
    To clarify the issue – and you can go through these steps too –
    – Upload an image/file to the media library
    – create a new post and add that new file to the post using the image field
    – save the post
    – go to the media library and you will see that the file is not “attached” to the post

    The issue is the same for new and existing posts. Hope that helps clarify it a bit more – let me know if you need more info.

  • Hi @whodeee

    Thanks for the extra info.
    I think I can see what the issue is here. When ‘selecting’ an image for the image field, the image itself is not updated.

    This explains why the ‘Unattached’ is showing.

    This data is only set when an image is first uploaded. If you upload it to the Media library, there is not post to attach it it. If you upload the image within a post, then it will be attached to the post.

    I believe this is the same as how WP treats images in the WYSIWYG.

    Please let me know if there is something I have missed, but I hope that explains what is going on.

    Thanks
    E

  • Hi @elliot,
    Yeah that is the issue, but what you mentioned is not true about the WordPress WYSIWYG, if you add an image/file with it it will get attached to the post even if it was in the media library originally.
    Using your WYSIWYG does it correctly as well. Any chance to get that same outcome with the image or file fields?

    Thanks

  • Hi @whodeee

    Thanks for the clarification. I’ll add this to the to-do and hopefully add it in soon.

    Thanks
    E

  • Thanks @elliot
    Would be great to know when it is added – I will watch for it!
    Thanks again for such a great plugin and for awesome support – top notch all around!

  • @elliot just checking to see if this item got added into the updates yet?

  • Hi @whodeee

    Not yet, this is a very busy time and I can’t guarantee this issue will be fixed ASAP, sorry.

    Thanks
    E

  • @elliot I use the my_acf_options_page_settings for all my clients backend to make a nice and clean admin. Having the ability to attach media to those specific pages setup would be amazing.

  • Hey @Elliot,

    I see this issue is still in effect, as I’m experiencing it myself. Just to add on to the information already provided by everyone else. I’m using the JSON API plugin to use WordPress strictly as an admin/backend, which makes proper image attachment critical as there won’t be any actual connection between wordpress and my eventual front-end beyond the API call.

    The steps to the bug remain:
    1) Upload an Image when attaching to ACF field = OK
    2) Upload an Image and THEN attach to ACF field = attachments field empty

    Additionally, when you remove an image from a post, it does not remove the associated attachment information. So on an API call where we’re looking at the attachments, we’ll be seeing attachments that no longer exist.

  • To anyone following behind, one short-term fix is to limit the images that can be uploaded to “Uploaded to Post”. This will limit the users ability to add images to the post to ones that have been explicitly uploaded to it. This should assure that the expected attachment information is included until Elliot and his team can get around to the long-term fix we’re all feignin’ for 🙂

  • Has this issue been fixed? I’ve noticed it when attaching images within a repeater on a post as well.

    http://support.advancedcustomfields.com/forums/topic/uploaded-to-information-in-media-library/

  • We solved this problem by this :

    function acf_save_post( $post_id ) {
    
        $file = get_field('upload_a_file', $post_id);
    	if( $file ){
    
    		$file_id = $file['ID'];
    		$post_to_update = array(
    			'ID'           => $file_id,
    			'post_parent'  => $post_id
    		);
    		wp_update_post( $post_to_update );
    	}
    }
    
    add_action('acf/save_post', 'acf_save_post', 20);
    

    Replace upload_a_file with your correct acf field.
    Basically we just modify the actual file post’s post_parent to the one it’s uploaded to.

  • Hello @darylldelfin

    I am experiencing the same issue. Could you give a little more information on how you fixed this issue? Where in functions is this change? How do I find the correct acf field? I uploaded a ton of images and did not realize this error until I had a ton. I am trying to figure out what is and what is not being used. I am afraid to delete any unattached images because I know some images are attached it just doesn’t say it.

    Thanks in advance!

Viewing 17 posts - 1 through 17 (of 17 total)

The topic ‘Image attached but not showing in Uploaded to column in Media Library’ is closed to new replies.