Skip to main content
  Thursday, June 21, 2018
  1 Replies
  4.1K Visits
  Subscribe
How do you access image meta data using the custom taxonomy system? I am currently using

get_terms( 'wpmf-gallery-category, [ 'hide_empty', => 0 ]);

to pull in a gallery. I would like access to the image data ( title, captions, url, ect). How can I do that with your taxonomy?
A
7 years ago
Hi,

Thanks for contacting us here about this extension.
How do you access image meta data using the custom taxonomy system? I am currently using

get_terms( 'wpmf-gallery-category, [ 'hide_empty', => 0 ]);

to pull in a gallery. I would like access to the image data ( title, captions, url, ect). How can I do that with your taxonomy?

You can use the code below to access to your image data:


$args     = array(
            'post_status'    => 'any',
            'post_type'      => array('attachment'),
            'tax_query'      => array(
                array(
                    'taxonomy'         => 'wpmf-gallery-category',
                    'terms'            => $gallery_id,
                    'include_children' => false
                )
            )
        );
        $query    = new WP_Query($args);
        $attachments= $query->get_posts();


Hope it helps!
Cheers,
  • Page :
  • 1
There are no replies made for this post yet.