Home Forums ACF PRO Custom Fields on Attachments


Custom Fields on Attachments

  • Hi

    I have added some custom fields to my images. How do I get the values from the attachments?

    Nothing I have tried is working; perhaps I’m looking in the wrong place?!

    Any help would be appreciated.

  • I think we might need a little more information: what type of fields, where/how are you trying to display them, and what have you tried so far?

  • I have added some custom fields to all attachments that are uploaded to the Media Library.

    Text fields such as Location, Date, and some custom Tags.

    I then have a custom post type of Photo Archive in which the admin can create a new post, upload as many images as they wish, which will then display on the single post page. The images are uploaded using the ACF Gallery field.
    Each image will have a tag or tags, as well as Location and Date information attached to it.

    What I now require is to get that information.

    So far I have created this staging site:

    If you see where it says Filter by tags; this is where I need to get all the tags used from each image, from within the single post.

    I did take a look at the code here but not sure where to put it or how to use it:

    Any advice would be much appreciated.

  • You need to loop through the images and use $image[‘ID’] in get_field() or the_field().

    The the “Retrieve from another image custom field” section of the page you linked to.

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

The topic ‘Custom Fields on Attachments’ is closed to new replies.