There is an example of how to do this on the official doc for WP_Query
:
https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters
Specifically, by declaring multiple items in the tax_query
and setting their relation:
Display posts that are in the quotes category OR have the quote post format:
$args = array( 'post_type' => 'post', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => array( 'quotes' ), ), array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-quote' ), ), ), ); $query = new WP_Query( $args );
Related Posts:
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- List all custom post type posts from a given category?
- tax_query returning all posts instead of selective posts in WP_Query
- Running a custom query inside another cpt single and trying to grab a variable
- Display related CPT with custom taxonomy
- Display Custom Post Type Based on Taxonomy With WP_Query()
- get_terms by custom post type
- How to limit the number of terms (terms acts like categories)
- How do I list custom taxonomy terms without the links?
- query multiple taxonomies
- Query Custom Post Type taxonomy type based on page
- The Operator “NOT IN” Does Not Work In tax_query
- wp_insert_term doesn’t work with custom post type’s taxonomy
- show tags of custom post type ONLY
- Retrieve single term slug
- display multiple term post from taxonomy in a single page
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- How to get the parent’s taxonomy?
- Sort the main query in subcategories/terms?
- Combine tax_query and meta_query in WP_Query
- Get list of terms of current taxonomy archive for another taxonomy
- Category page only displaying the posts from a custom type
- Show Post Count of a Category
- Have a Custom Post Type index page display taxonomy items instead of posts
- How to check the terms in single custom post type template
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- Query Multiple Taxominies Across Multiple Post type’s
- Query custom post type by category slug
- Filtering WP_Query Dynamically on the Front-End
- How to Filter custom post type by taxonomy?
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- Why is this query not working? (Standard posts + custom post type)
- Several post types on WP Query by tag and taxonomy
- Using meta_query and tax_query at the same time
- Custom Widget WP_Query problem
- How do I display the grand child items of a taxonomy term?
- Display latest x posts from all categories in Custom Post Type/Taxonomy
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- How to display Related Posts based on number of taxonomy terms matched
- Output terms for custom post types
- tax_query not working in template
- Print current post category during WP_Query
- Variable not working in WP_Query
- WP_Query parameter conflict
- Query all post and CPT from 2 specific taxonomies AND by ACF custom field
- Get category if used in a custom post type
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- tax_query (if the terms are empty)
- Sort results without WP_QUERY?
- Custom Taxonomy Terms in Menu lead to which page?
- Get posts by category name
- Custom Post Type Taxonomy Term Order by Title
- wp_dropdown_pages with tax_query clause
- Query Custom Post Type by Taxonomy
- Get_the_term_list inexplicably adds values in foreach
- Query all posts under one taxonomy? Why is my code not working?
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- “Menu order” being ignored when querying posts from a parent taxonomy with “include_children” set to true
- Custom Query: Multiple CPTs and a taxonomy filter
- How to automatically create a terms based on each post of a post type
- Get List of Terms based on a given term (different taxonomy)
- Page that lists publications by classifying them by taxonomy
- CPT : Next or Previous term link when has not adjacent post
- Order posts by taxonomy terms
- custom post type and a “sticky” position taxonomy
- display post count in archive page that have relation with another taxonomy term
- Filtering posts based on three taxonomies
- get taxonomies from terms
- How to search through all child taxonomies using WP_Query?
- How to order taxonomy terms by most recent post?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Cannot get to work tax_query array for terms
- Get all posts for custom taxonomy term
- Custom Taxonomy – fields
- Pages of my taxonomy terms are showing all posts
- tax_query not working?
- One of my headings is mysteriously coming up as a link in my CPT Archive
- WP Query tax_query not returning posts
- Query for a custom post taxonomy
- Filter Term By Parent Term – Custom Post Type
- Filter By Term Not Working – Custom Post Type
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Display all Custom taxonomy terms and their relevant custom posts
- Get posts of an specific term of a custom taxonomy
- Query breaking with ‘posts_per_page’ => -1
- Create an additional template page for every term taxonomy
- tax_query showing no results
- How to display elements of different post types?
- category_name not working in WP_Query
- List a custom post type’s posts ordered by nested custom taxonomy
- Cannot query custom post type taxonomy from theme options array
- get_the_term_list() wanting to loop through the returned values
- List custom taxonomy terms
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- Using tax_query to get single post per category
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List
- How do I get parameters from the URL?
- Taxonomy Archive URL + Template