From the WordPress codex for wp_query:
Display posts tagged with bob, under ‘people’ custom taxonomy:
$args = array(
'post_type' => 'post',
'people' => 'bob'
);
$query = new WP_Query( $args );
Display posts tagged with bob, under ‘people’ custom taxonomy, using tax_query:
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob'
)
)
);
$query = new WP_Query( $args );
See the Codex page for more examples.
Related Posts:
- Using wp_query is it possible to orderby taxonomy?
- Get Posts Under Custom Taxonomy
- get_posts assigned to a specific custom taxonomy term, and not the term’s children
- Get term SLUG by term ID
- How to use taxonomies on attachments with the new Media Library?
- How to add images to taxonomies?
- Can you add the visual editor to the description field for custom taxonomies?
- Check if a post has any term in this custom taxonomy?
- custom post type taxonomy “tag” archive : no post found
- Add custom taxonomy fields when creating a new taxonomy
- Contact Form 7 – Populate Select List With Taxonomy [closed]
- How to display custom taxonomies in posts?
- Get taxonomy names by post id
- Creating Custom Taxonomy without mapping to any post type
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Custom taxonomy hide meta box but show in menu
- display posts with same taxonomy term
- Exclude specific slug in ‘get_terms’
- wp_insert_term – parent & child problem
- Is there a way to disable a term rather than deleting it?
- Templates files for custom post type with custom tags
- Sort Taxonomy List by Custom Values
- Custom taxonomy escaping html attr
- Showing list of custom posts of a custom taxonomy
- Display taxonomy posts
- Show portfolio category slug in url ( if exist)
- Creating a Taxonomy Page [duplicate]
- switch statement for taxonomy content
- Add image to taxonomy and output to homepage
- Change order custom taxonomy
- Looking for suggestions on creating simple database (Help!!)
- How do you search for a post by custom taxonomy?
- Display taxonomy term slugs
- Get Posts by tag from a custom taxonomy
- Extra fields on categories that is available via the WP-API?
- Can I use multi (sub) levels of relation (AND | OR) on custom query?
- How to display custom taxonomy
- Index page of posts tagged with two separate taxonomies
- Child Pages and Custom Taxonomies
- Custom taxonomy – query returns an error
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Remove taxonomy menu without removing the metabox?
- How to perform a search inside a specific taxonomy category
- Register custom taxonomy from a Advenced custom field option page
- Taxonomy term breadcrumb; how?
- add custom fields in custom taxonomy meta box in wordpress-3.5.2
- How to permanently delete a taxonomy
- Sorting Custom Taxonomy in ASC/DESC order?
- How can i set post_per_page in my taxonamy?
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- Advanced AND tax_query in sidebar with 2 taxonomies
- create taxonomy
- Select default taxonomy on dropdown
- Using wp_query is it possible to orderby taxonomy?
- WordPress Taxonomy Menu
- List of taxonomy archive index page links
- Get Posts with matching lowest taxonomies
- Alternative for is_taxonomy() to workaround theme’s default sidebar
- What is the current page’s Taxonomy?
- Loop custom post type by taxonomy (Category)
- Any way to make custom taxonomy field searchable?
- Get custom taxonomy term url on archive page
- Custom Taxonomy Template Variables Available?
- query posts returns 10 records
- get_terms() – unexpected ‘=>’ (T_DOUBLE_ARROW) error
- Display woocommerce product_cat child terms with thumbnails
- get_term_children specific no id
- tax_query not working properly with get_posts
- query grandchildren taxonomy terms
- Custom Search only for my Custom Taxonomy Page – data
- Insert taxonomy term to different table
- Getting taxonomies specific to categories
- Remove Tag Cloud Words from Custom Taxonomy
- How to add/enqueue Custom CSS for a custom taxonomy page?
- wp_get_object_terms count on taxonomies within an category archive
- Adding new terms to custom taxonomy
- Group custom taxonomies based on tags contained in their posts
- Make custom post type display with custom taxonomy in url
- Prevent random entries in hierarchical false taxonomies
- Exporting CSV of users with custom user taxonomies out of WordPress
- How do I create a term for every value of a post meta?
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- is_tax not working for custom taxonomy
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Add custom display condition to Elementor Theme Builder for custom taxonomy children, grandchildren, and great-grandchildren
- Save selected terms in order of custom taxonomy in post
- How to delete unused terms?
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?
- Child terms with improper parent in the url should redirect to 404
- Taxonomy entries are spawning copies of existing entries with the new title as the existing ID, since upgrade
- How to get parent and child name in taxonomy page
- How to enforce a requirement for custom taxonomy
- Issue with WordPress Automatically Assigning Terms to Multiple Posts
- Change taxonomy key of existing and future taxonomy posts
- Cannot set custom taxonomies when creating post
- How to call parent and child category name in separate div?
- Taxonomy archives based on Custom Post Types
- Creating a page that will dynamically get posts from 2 taxonomies
- Hiearchical terms structure and performance