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:
- Search custom taxonomy term by name
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- How to display post from current Taxonomy in archive page?
- What kind of object type is WP_Query?
- Display posts the match taxonomy term linked from wp_list_categoies?
- How can I save an array from a random post sequence for later use?
- Getting an array out of WPQuery
- Use Transient API to cache queries for all posts in all categories?
- Move posts to top of WP_Query if in certain Taxonomy?
- Querying Multiple Custom Taxonomy Terms
- Placing a div or img in between a post array using WP Query [closed]
- Filtering posts by custom field value not working
- How can I get an array of all IDs from the current queried object?
- How can I pick a single post from the latest 3?
- Order taxonomy terms in alphabetical order
- How do I search inside specific taxonomies in WordPress
- Minimize database queries to user tables?
- Output an array of terms for a ‘tax_query’ => array()
- 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)
- WP_Query Not Recognizing Taxonomy Parameter in Custom Search
- Remove category from query (show all posts in archive.php) pre_get_posts()
- Display Featured Post by Categories and Avoid duplicated posts
- Get authors by term id or slug
- WP Query Args – Title or Taxonomy Value
- 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
- Slow queries on a huge database
- How do I exclude the lowest level terms in a taxonomy?
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- wp_query args adding muitiple tax_querys
- Automatically Query Parent Taxonomy
- Redirect to another page using contact form 7? [closed]
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- Taxonomy order exception for specific term
- Custom taxonomy.php not working
- Removing duplicate values between two wordpress queries
- WP_Query for a taxonomy with different taxonomy types
- Combine results of multiple WP_Query to resemble single WP_Query
- Does meta_value (array) work with ‘orderby’?
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- How to add custom meta to ‘pre_get_terms’?
- Get Child Category only
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Get posts in taxonomy randomly
- Loop posts based on permalink term
- How can I comment comma-separated array values?
- WP_Query with page_ids in arguments without a result
- Related Posts Excluding Certain Categories
- Query using string from custom field as array value
- Multiple meta query from array
- Category based on post id
- How to avoid filling up an array each time I run a WP_query?
- Don’t repeat posts from children in parent taxonomy query
- meta_query returning excluded result
- Show multiple tax_query from 2 or more post_type in a single code
- Custom taxonomy in WP_Query not working
- get_the_terms has strange result since version 6.0
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- Use get_cat_ID to retreive multiple category IDs
- Strange behaviour of hierarchical taxonomy archive
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Combine relationship posts with existing wp_query
- Only show tag with the same id as the post
- Counting instances of words in the results of a post query
- How to use the Term Object from a custom select field in a query
- WP Query by 4 different taxonomies
- Trouble with serialized metadata
- wp_query with meta_query and tax_query
- What code to use in an array to call the current sub-category?
- WP_Query paginate with one term per page?
- How to break up output of posts for different terms on same page?
- Repeat array inside array through while loop
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- taxquery taxonomy get terms
- pages shortcode filtering by category
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- Related Post by Tags Code
- Taxonomy Terms That Don’t Exist Display Results
- Category Archive not working for pages
- How can I get all the posts that are related with a specific taxonomy term?
- WP Query with sticky posts and tax_query
- Search format not matching taxonomy query
- how to query for meta_value have array
- wp_query – Modify $query to include duplicate content
- How to get several fields from wp_query?
- How to sort a WP_Query array by post_name after an array_merge();
- WordPress WP_Query Array Custom search via taxonomies
- WP Query posts__in not working with array
- Sort Posts with custom meta key by default which is currently set as optional
- Dynamically name array in WordPress loop – add/get values
- Creating Custom Query
- Multiple Orderby is not working right
- tax_query not working properly with get_posts
- How do I have multiple metaqueries inside one wordpress query
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?