I think this is what you are searching for… You must use both post_type and tax_query to filter your query
$query = new WP_Query( array(
'post_type' => 'books', // name of post type.
'tax_query' => array(
array(
'taxonomy' => 'fiction', // taxonomy name
)
)
) );
while ( $query->have_posts() ) : $query->the_post();
// do stuff here....
endwhile;
/**
* reset the orignal query
* we should use this to reset wp_query
*/
wp_reset_query();
Related Posts:
- WordPress Doesn’t Generate Taxonomy Archive
- Custom Post Type with Nested Taxonomy and Template Files
- Trying to manage templates on a blog with lots of custom taxonomies
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- taxonomy – templates are not loading
- Templates for CPT not working
- I want to create an archive and single page for a custom taxonomy for a custom post type
- Define multiple prefixes for custom post type
- How to order taxonomy terms by most recent post?
- Custom taxonomy returns 404 even with saving permalinks
- Create custom post type categories
- How to add CSS class field in Custom Taxonomy?
- Custom Post Taxonomy Template Not Loading Properly
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Taxonomies are not showing in the category dropdown
- Change custom post taxonomy values from front-end
- Display 3 level taxonomies
- Set a Default CPT taxonomy by taxonomy id
- Get all posts for custom taxonomy term
- List posts that have the current url taxonomy
- Listing all custom posts having a specific taxonomy whatever the terms
- Templating advice sub posts of a CTP
- List all posts associated under custom taxonomy
- How to transfer categories (default) to custom taxonomy?
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- How to manage a dynamic multi-level page hierearchy system?
- Custom Taxonomy – fields
- Display custom tax in “while” loop
- Specific template for subcategory of custom taxomy
- Categories manage
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- Pages of my taxonomy terms are showing all posts
- tax_query not working?
- Taxonomy template file not working with a taxonomy that contains a slash
- Custom post type category link + add to menu
- Custom taxonomy with custom post type template not showing
- Custom taxonomy template for custom fields loop [closed]
- Showing taxonomies with terms that are attached to custom post
- If custom taxonomy exist on post?
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- How to get all posts assigned to a taxonomy term only?
- Custom Taxonomy page redirecting to 404 page
- Changing an item in drop down after 5 latest posts per taxonomy
- How should i name the .php file to show custom posts under a taxonomy’s term?
- Organising custom taxonomies and custom post types
- Taxonomy’s title
- Display all posts from single taxonomy term
- Connect 8 Taxonomies to One (Main) taxonomy. How to?
- Filter Term By Parent Term – Custom Post Type
- Filter By Term Not Working – Custom Post Type
- How to show post which has the specific taxonomy terms?
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Custom post type taxonomy template and URL confusion
- Best approach to allow front-end display of posts’ reviewers?
- WordPress add taxonomies/terms list as a menu in archive page
- Custom Post Type tag taxonomy “Page Not Found”
- Custom Taxonomy is disabled on Edit page
- Override “Parent” input for custom taxonomy
- template structure for CPT not clear
- Custom Homepage As Single Page or Custom Post Type?
- Custom Post Type and Taxonomies, creating the corresponding template file and loop the data
- WordPress Custom taxonomy template
- How to create TEMPLATES for TAXONOMIES? What I have to change in this code?
- List all posts from custom post type by taxonomy
- Displaying taxonomy icon outside archive page
- Custom post type post taxonomies
- Connecting multiple post types? Or linking “News” posts with “Game” posts how?
- How to display custom taxonomy
- How to display custom post types AND regular posts separately on a shared taxonomy archive?
- Querying multiple taxonomies in URL leads to wrong taxonomy archive
- Sort by Custom Post Type (Multiple Loop)
- Archive templates based on taxonomies
- Show taxonomies from specific CPT
- insert a taxonomy for a custom post type
- How to display elements of different post types?
- List a custom taxonomy’s terms, with links, on the taxonomy page
- How to display only taxonomies of custom post type in a page?
- Custom Post Type Template based on Taxonomy
- Check if taxonomy is attached to at least one post in a post-type
- Looping taxonomy in taxonomy?
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Custom posts and custom taxonomies for many products and categories?
- Most appropriate way to display CPT’s by children terms of custom taxonomies while retaining desired permalink structure?
- get_the_term_list() wanting to loop through the returned values
- List custom taxonomy terms
- How do i get the taxonomy term name on the CPT archive page?
- Custom Taxonomy Template Variables Available?
- Only One Post of Custom Post Type Appearing on Template Page
- See the process of creating a taxonomy and tell me where I made a mistake
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List
- Get all active posts that are tied to a custom taxonomy for a custom post type
- Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected
- How to add to taxonomies to a post type
- Filtering custom post types using category taxonomy
- Taxonomy listing issue – does not display how I would like
- Custom taxonomy meta fields
- Show custom category archive as front page and remove taxonomy slug from urls
- Is it possible for post and custom post type to share a category base slug?