Support

Account

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

  • Hi @alynefrancis

    Q1:
    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');
    

    Q2:
    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/