Home › Forums › Add-ons › Gallery Field › Gallery field – echo a custom taxonomy as a class in the image container › Reply To: Gallery field – echo a custom taxonomy as a class in the image container
An image is really a post type “attachment” as I’m sure you know. The ID in the $image is thus the attachments ID. So you should be able to fetch the term like:
//will return an array of term objects. $terms = wp_get_object_terms($image['ID'], 'image_gallery');
ACF uses the same image modals as WordPress core so this is really not an ACF thing. You’ve registered your custom taxonomy and now you need to add it to the modal. I don’t have any code for this but I’m sure you can find some by googling 🙂
There’s also plugins out there and this is one of the most tested: https://wordpress.org/plugins/enhanced-media-library/
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!
© 2022 Advanced Custom Fields.