Title: API
Last modified: August 21, 2016

---

# API

 *  Resolved [mtissington](https://wordpress.org/support/users/mtissington/)
 * (@mtissington)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/api-20/)
 * Using php, how can I get a list of images (or media) that belong to a particular
   tax and category?
 * [https://wordpress.org/plugins/enhanced-media-library/](https://wordpress.org/plugins/enhanced-media-library/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [webbistro](https://wordpress.org/support/users/webbistro/)
 * (@webbistro)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/api-20/#post-4604832)
 * Something like this:
 *     ```
       <?php 
   
       $args = array (
       	'post_type' => 'attachment',
       	'post_status' => 'any',
       	'posts_per_page' => -1,
       	'tax_query' => array(
       		'relation' => 'AND',
       		array(
       			'taxonomy' => 'YOUR_TAXONOMY_NAME',
       			'field' => 'slug',
       			'terms' => 'YOUR_TAXONOMY_TERM_NAME'
       		),
       		array(
       			'taxonomy' => 'category',
       			'field' => 'slug',
       			'terms' => 'YOUR_CATEGORY_NAME'
       		)
       	)
       );
       $the_query = new WP_Query( $args );
   
       if ( $the_query->have_posts() ) :
   
       	while ( $the_query->have_posts() ) : $the_query->the_post(); 
   
                   echo wp_get_attachment_image( get_the_ID(), "thumbnail");
   
             endwhile; 
   
       endif;
   
       wp_reset_postdata(); 
   
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘API’ is closed to new replies.

 * ![](https://ps.w.org/enhanced-media-library/assets/icon-256x256.png?rev=980107)
 * [Enhanced Media Library](https://wordpress.org/plugins/enhanced-media-library/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/enhanced-media-library/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/enhanced-media-library/)
 * [Active Topics](https://wordpress.org/support/plugin/enhanced-media-library/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/enhanced-media-library/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/enhanced-media-library/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [webbistro](https://wordpress.org/support/users/webbistro/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/api-20/#post-4604832)
 * Status: resolved