Support

Account

Home Forums Backend Issues (wp-admin) How to connect ACF field to existing media fields

Solving

How to connect ACF field to existing media fields

  • I am novice so forgive my lack of expertise.

    I’ve read Adding fields to Media Attachments and indeed I can ADD fields to the media file. but is there a way I can insert values from the existing media fields?

    I want to be able to retrieve files from media library along with their title, caption and description so that user can enter/update that data on post entry page. Also would it be possible for user to add an image to the media library from the edit post page?

    Is there a way to do this from the field group screen?

    I am using Elementor Pro.

  • Image fields allow editing of the media related content. Click on the edit icon after adding an image brings up the editor.

    A gallery field allows editing these fields by selecting an image.

    ACF fields that use images save the image to the media library.

    Everything that you are looking for, as far as I can tell, is built in.

    I don’t understand why you are adding fields to media for title, captions and description since these are built into WP.

  • Yes I did see that I could add the info there which is great. However, my problem is that I want to access those fields in Elementor Pro dynamically. For an image, my only dynamic choice in Elementor is an ACF field. So if I can assign the image info field to ACF fields, then I’ll be able to access it from Elementor. Yes, it probably is a kludge…

    For example, I can retrieve the featured image into ACF image field by assigning _thumbnail_id to a field.

    If there is a way to access the media file data directly, that would also work for me.

    I do not have Pro version yet.

  • I would contact elementor.

    If you really want to do this it would require creating an acf/save_post action to either get the values from the attachment and add them to the post or to use values in the post to update the image.

    If I really needed to do this I would pull the values from the image and save them to a standard WP custom field without supplying a field to edit them.

    Or I would create fields and use these while ignoring the values in the image. This would be the case if I wanted to allow the user to have different values for each image on every post. In this case I would make them required and most likely use an acf/load_value or acf/prepare_field filter to preset these fields to what is held in the WP fields for the image.

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

You must be logged in to reply to this topic.