Get all attachments by custom taxonomy – term
To get all images from the same term you can use WP_Query with the “tax_query” argument: $args = array( ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ‘post_type’ => ‘attachment’, ); $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘YOUR_CUSTOM_TAXONOMY’, ‘terms’ => array( ‘YOUR_CUSTOM_TAXONOMY_TERM’ ), ‘field’ => ‘slug’, ), ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() … Read more