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?
- 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
- Why is my WP_Query not working when tax_query terms are an array?
- assign 2 $args to one wp_query
- 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
- WP Meta Query for some meta (array) values
- meta_query with array as value
- Placing a div or img in between a post array using WP Query [closed]
- 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
- Filtering posts by custom field value not working
- Display link to taxonomy archive only if it has posts with certain custom field values
- 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
- Is it possible to dynamically get queried term AND taxonomy?
- How do I search inside specific taxonomies in WordPress
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Combine relationship posts with existing wp_query
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- Only show tag with the same id as the post
- Counting instances of words in the results of a post query
- tax_query not working on custom post type
- Save queried result into database
- sanitize_post() is not sanitizing Post Object
- How to use the Term Object from a custom select field in a query
- Retrieve all custom field values of a specific custom field metakey as an array, inside WP_Query
- WP Query by 4 different taxonomies
- Trouble with serialized metadata
- WooCommerce WP_Query using tax_query returns no results (0 = 1)
- 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?
- 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?
- Repeat array inside array through while loop
- Custom category page with taxonomy filters
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- Sorting Posts by Taxonomy thats not within the query’s $args
- 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
- date_query problem
- Category Archive not working for pages
- How can I get all the posts that are related with a specific taxonomy term?
- Custom taxonomy and query multi conditions
- WP Query with sticky posts and tax_query
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- WP_Query: Meta_Query with serialized value (or a workaround)
- Search format not matching taxonomy query
- how to query for meta_value have array
- wp_query – Modify $query to include duplicate content
- Iterate through ID’s in loop
- How to get several fields from wp_query?
- How to sort a WP_Query array by post_name after an array_merge();
- Issue with WP_Query (need a array of selected ID’s)
- WordPress WP_Query Array Custom search via taxonomies
- Get the tax term in which is a post via wp_query
- 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
- Dynamically create array from page title
- WordPress Query Returning Every Post
- 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
- Custom query for certain post type OR another post type with a certain category
- 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
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2
- Orderby meta _value that is saved as an array
- Filter on one post type with taxonimy and get other post type
- Loop a Single Taxonomy and Output all Posts Associated (but also show a message for empty ones)
- Query for posts belonging to multiple categories
- Query top level custom post in taxonomy
- Include custom post type that matches taxonomy field in another custom post type
- Showing all posts of the current custom taxonomy on archive page
- Need help with Query Loop. Need to get current taxonomy term and its posts and group them by a different selected taxonomy term
- Custom tag template to list posts in ASC order