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
- How to get all taxonomies of a post type?
- Taxonomy, Terms, and Template Files
- Custom taxonomy not showing up when adding a new custom post type
- How do I list custom taxonomy terms without the links?
- How to list custom taxonomy categories?
- Get page by template?
- How to list all categories and tags in a page?
- Custom taxonomy query for a custom post type
- Create an archive page for custom taxonomies
- Is it possible to have an index page for taxonomy term for each custom post type it is assigned to?
- Custom Post Type Archive Template
- How do I list terms of a custom taxonomy at i.e. domain.com/brands/
- wp_insert_post custom taxonomy
- custom taxonomy – Template not working
- Taxonomy-{taxnonomy}.php is not working
- Get list of terms of current taxonomy archive for another taxonomy
- Associate Taxonomies Across Post Types
- Show Post Count of a Category
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Custom post type and taxonomy permalinks – Structure
- Relationship between two taxonomies and a custom post type [closed]
- Menu Multiple Taxonomies
- How to make a custom taxonomy selectable in post publish area?
- Custom Taxonomy term archive template
- Problem with custom post types, taxonomy and permalinks
- How to create new category for custom post type?
- Custom page template for category taxonomy
- How do I get array of types associated with a taxonomy?
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Display all posts in main category and 1 subcategory
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- How to Filter custom post type by taxonomy?
- Is it possible to have dedicated page for parent/child taxonomy?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Custom taxonomy and custom post type – wrong permalinks and template
- Display a grid of taxonomy terms at root taxonomy page
- limit value taxonomy based on previous taxonomy value wordpress
- How do I display the grand child items of a taxonomy term?
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Custom taxonomy returns 404
- Taxonomy in URL
- How can I get this request to use the Custom Post Type page template instead?
- Archive for a Taxonomy of a Custom Post type
- How to Set Taxonomy Object Description?
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Main query not querying any posts in custom taxonomy template
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- get_category_link() for custom post type does not include custom slug rewrite?
- Targeting categories in custom fields
- Alphabetically sort a taxonomy.php template by post title
- Which file/template is in charge of taxonomies for custom post types?
- Custom Post Types not queried in Custom Taxonomy archives or Native archives
- Changing CPT slug and taxonomy already registered in parent theme
- How to create a template to show child terms of a MAIN taxonomy
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Custom Taxonomy Terms in Menu lead to which page?
- Getting custom taxonomy posts on archive page
- Query Custom Post Type by Taxonomy
- Custom post types templates
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- Custom taxonomy returns 404 even with saving permalinks
- Create custom post type categories
- How to add CSS class field in Custom Taxonomy?
- Set a Default CPT taxonomy by taxonomy id
- List all posts associated under 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?
- Categories manage
- Add other all taxonomies as meta boxes to custom post type
- How to get post type archive category title
- Custom post type category link + add to menu
- Custom taxonomy with custom post type template not showing
- How should i name the .php file to show custom posts under a taxonomy’s term?
- Organising custom taxonomies and custom post types
- Filter Term By Parent Term – Custom Post Type
- Best approach to allow front-end display of posts’ reviewers?
- Custom Post Type tag taxonomy “Page Not Found”
- template structure for CPT not clear
- Custom Post Type and Taxonomies, creating the corresponding template file and loop the data
- 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
- Archive templates based on taxonomies
- Show taxonomies from specific CPT
- List a custom taxonomy’s terms, with links, on the taxonomy page
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Only One Post of Custom Post Type Appearing on Template Page
- Get all active posts that are tied to a custom taxonomy for a custom post type
- How to add to taxonomies to a post type
- Custom taxonomy meta fields