If I understand right, you need all attachments (attached or not) with specified term?
$args = array(
'post_type' => 'attachment',
'my_taxonomy' => 'my_taxonomy_term'
);
$my_query = new WP_Query( $args );
if( $my_query->have_posts() ):
while ($my_query->have_posts()) : $my_query->the_post();
// your stuff here
endwhile;
}
// Don't forget to reset
wp_reset_postdata();
Related Posts:
- How to add images to taxonomies?
- Custom Taxonomy and Tax_Query
- How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?
- SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement
- Combine multiple custom user taxonomy in single url
- Advanced Tax Query
- Improving WP_Query performance for multiple taxonomies
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- How can I display all post IDs from the taxonomy?
- Get ID and slug from taxonomy object
- How to display custom taxonomy in multiple columns?
- Custom taxonomies making WP very slow – Way to fix?
- How to count the number of terms in a taxonomy
- Sorting taxonomy columns by meta value numeric
- Get Taxonmy Term ID For Current Post
- Display sub categories and their data of a taxonomy
- Advanced Query Logic With Multiple Taxonomies
- Display only first level children of my custom taxonomy categories
- Changing stylesheet depending on custom taxonomy terms
- How do I taxonomy terms based on terms they are used alongside?
- Custom taxonomy [year] is directing to yearly archive
- Get posts by term slug only
- Taxonomies on custom taxonomies
- Add Custom Taxonomy for Blog Meta Info
- Search Tool only refreshes Page without showing results
- Getting associated taxonomies
- How to fetch the data from Advanced Custom post when we search specific keyword or field name related to the post?
- How to add images to taxonomy terms? [duplicate]
- one post per term taxonomy
- Show only the sub-categories (and their content) of the current custom taxonomy with ‘taxonomy.php’
- Using Advanced Custom Fields Relationship Field to select a taxonomy term
- Custom arguments in WP_Query
- check if a taxnomy queried in $wp_query?
- WP_Query tax_query – Show results if child has parent X
- Query custom taxonomy for category including children
- Variable Not Working Inside is_author() Array
- How to get related taxonomies based on a category with mysql query?
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Tracking the name of a custom taxonomy
- Add terms to a taxonomy archive from within the same taxonomy
- Is it possible to filter a taxonomy archive by other taxonomies that are on posts?
- Fill New Taxonomies
- Custom Taxonomies Archive Page 404
- WordPress taxonomy terms archive template help
- Make relation of custom taxomies
- List active taxonomy terms
- taxonomy query on front page
- How do you search for a post by custom taxonomy?
- Next/Previous links in custom taxonomy, where item may belong to multiple terms
- How to query authors by custom taxonomy?
- Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
- How to get multiple Taxonomies not All Taxonomies?
- WordPress Taxonomy Menu
- Primary Taxonomy for Post
- Get taxonomy image for Toolset custom taxonomy through Toolset Views Shortcode
- wp_get_object_terms count on taxonomies within an category archive
- List posts grouped by children of a custom taxonomy
- Make custom post type display with custom taxonomy in url
- Hook to filter based on form value and insert term
- Complex Taxonomy scheme
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Foreach for get_the_terms for hierarchical taxonomy don’t repeat Top Level Terms if contains multiple Second Level Terms
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Archive template for taxonomy terms
- pre_get_posts OR relation between taxonomy and author
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Dynamic page slug for Custom Taxonomies?
- show term description instead of list terms of custom taxonomy
- get_the_term_list without specific category
- Add Category Name to REST API
- Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order
- Edit post meta with checkboxes on front end
- Custom taxonomy sort by term meta in admin columns
- How to show the entries in a custom taxonomy by author?
- Taxonomy with_front causes all
- Why is my taxonomy template not shown?
- cannot get multiple loops using tax_query
- How to add a Rewrite Rule / Category Structure
- Hide posts having children terms when display posts by category in edit.php
- How to have two different versions of a tag/category/taxonomy archive page?
- List of users inside custom taxonomy
- how does the wordpress rest API work
- Taxonomy terms can still be added when only assign_terms capability has been granted
- tax_query not working
- wp_query not resetting, last post hanging
- custom taxonomy not showing in Gutenberg
- Can I add other Custom Taxonomy to my syntax (functions.php)
- Display children category images
- Is there a way to change select-list for new custom taxonomy?
- How to define %category% for custom taxonomies?
- See double taxonomy inputs in WP editor
- Problem with wp_list_category with custom taxomy
- ajax drop down change second drop down data
- Redirect or Prevent Viewing of Custom Taxonomy’s Archives?
- Tax query array terms display out of order
- Function code problem
- Permalinks not working on MU network with domain mapping
- Get custom taxonomy term url on archive page
- Taxonomy to display form after creation
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back