tax_query requires an array of arrays, and $the_taxes is an array of arrays, you’ve already got 99% of your answer.
foreach ($taxes as $tax) {
$the_taxes[] = array (
'taxonomy' => $tax,
'field' => 'term_id',
'terms' => $terms,
);
}
$the_taxes['relation'] = 'OR';
$args = array(
'post_type' => 'post',
'tax_query' => $the_taxes,
);
Related Posts:
- WP query taxonomy input differs to output?
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- How can I save an array from a random post sequence for later use?
- Why is my WP_Query not working when tax_query terms are an array?
- assign 2 $args to one wp_query
- Move posts to top of WP_Query if in certain Taxonomy?
- Querying Multiple Custom Taxonomy Terms
- WP Meta Query for some meta (array) values
- meta_query with array as value
- Show one post per author and limit query to 8 posts
- Filter and list posts of a custom taxonomy
- WP Query – Get WooCommerce Products with variation that is in stock
- Filter WordPress posts by between parameter
- How to Modify Taxonomy Archive Page with Search Parameter?
- How to add terms to my tax_query based off of the current post
- How add a custom posttype name using ACF field to a query post array
- Display link to taxonomy archive only if it has posts with certain custom field values
- Is it possible to dynamically get queried term AND taxonomy?
- Pass array of taxonomy terms to wp_query
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Minimize database queries to user tables?
- Order by slug in get_terms with multiple taxonomies
- Function get_queried_object() return NULL in custom taxonomy
- Getting Taxonomy inside WP_Query Loop
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Complex WP_Query (two post types and multiple operators)
- Adding an array from a query string to a WP meta_query
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Remove category from query (show all posts in archive.php) pre_get_posts()
- is_tax() function not working as expected
- Display Featured Post by Categories and Avoid duplicated posts
- Get authors by term id or slug
- Weird orderby => post__in issue
- WP_Query tax query part of slug
- Taxonomy Query Relation field not behaving correctly?
- How to list custom fields as headers and list all pages sharing that custom field under it?
- How to Union two different conditions in one WP_Query
- How do I exclude the lowest level terms in a taxonomy?
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- Post loop for all taxonomy terms
- Taxonomy and Date in same query?
- Query all posts if multiple meta key don’t exist
- Get posts by list of post IDs ordered by those IDs?
- Taxonomy order exception for specific term
- Removing duplicate values between two wordpress queries
- Include current post into loop
- Combine results of multiple WP_Query to resemble single WP_Query
- How do I turn these values from MYSQL into an array
- Using custom taxonomies in a query
- Get posts from multiple tax terms
- search serialised meta_value for date value?
- Combine 2 arrays in a query parameter
- Loop posts based on permalink term
- How to echo woocommerce category name
- How do I add a relation parameter to my filter query?
- construct complex queries with WP User Query
- WP Query – filtering terms with regex
- Get a list of ACF Repeater-Fields as array
- How to get posts by category and by choosing a taxonomy term?
- relation OR instead of AND – Filtered term ID’s in loop
- How to get specific string in explode array?
- Don’t repeat posts from children in parent taxonomy query
- Remove from array in WP_Query loop
- Show multiple tax_query from 2 or more post_type in a single code
- get_the_terms has strange result since version 6.0
- Exclude post with taxonomy and from the terms (taxonomy & tag) posts count
- Strange behaviour of hierarchical taxonomy archive
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- tax_query not working on custom post type
- Save queried result into database
- sanitize_post() is not sanitizing Post Object
- Retrieve all custom field values of a specific custom field metakey as an array, inside WP_Query
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- WP_User_Query Orderby Not Working
- WordPress – Form does not filter the results of taxonomies
- Loop through array of pages
- Show one post of each custom taxonomy
- How to break up output of posts for different terms on same page?
- Custom category page with taxonomy filters
- Sorting Posts by Taxonomy thats not within the query’s $args
- taxquery taxonomy get terms
- How to define a custom hierarchy for terms?
- date_query problem
- Custom taxonomy and query multi conditions
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- WP_Query: Meta_Query with serialized value (or a workaround)
- wp_query – Modify $query to include duplicate content
- Iterate through ID’s in loop
- How to get several fields from wp_query?
- Issue with WP_Query (need a array of selected ID’s)
- Get the tax term in which is a post via wp_query
- WP Query posts__in not working with array
- Dynamically create array from page title
- WordPress Query Returning Every Post
- Multiple Orderby is not working right
- I want to place a post before all others from an ACF boleen field
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- wp_query, calculate with two dates when ‘key’ is text format
- Filter on one post type with taxonimy and get other post type
- Showing all posts of the current custom taxonomy on archive page