The problem is ambiguity, you can’t just put in 'relation' => 'OR'
in the main parameter list, because how would WP_Query
know if it’s for the tax_query
and not the meta_query
?
For how it’s supposed to work, and where the relation
parameter goes we need to refer to the official docs for WP_Query
which gives us this example:
$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 );
Setting it may be as simple as:
$myarray['relation'] = 'OR'; // untested
Related Posts:
- How to add custom meta to ‘pre_get_terms’?
- How to show terms from another taxonomy
- Why is my WP_Query not working when tax_query terms are an array?
- How to add terms to my tax_query based off of the current post
- Is it possible to dynamically get queried term AND taxonomy?
- Empty tax_query array returns an empty array
- How do I search inside specific taxonomies in WordPress
- Formulate a url to show posts with both taxonomy terms
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- Function get_queried_object() return NULL in custom taxonomy
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Get authors by term id or slug
- Slow queries on a huge database
- Taxonomy order exception for specific term
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- 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?
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Only show tag with the same id as the post
- Save queried result into database
- taxquery taxonomy get terms
- How to define a custom hierarchy for terms?
- How can I get all the posts that are related with a specific taxonomy term?
- How to get several fields from wp_query?
- Displaying Results From Custom Taxonomy Query
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- What is the most efficient way of querying posts based on visits and date for current day?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- How to find objects by terms
- Order posts by tags count?
- Add and in the header while looping over custom query in page template
- Move posts to top of WP_Query if in certain Taxonomy?
- Which custom query am I in and how can I access its properties & methods?
- Querying Multiple Custom Taxonomy Terms
- Order terms inside a select dropdown
- WP Query – Get WooCommerce Products with variation that is in stock
- How to speed up wp_query, took more 5s to run against 100k posts
- How to Modify Taxonomy Archive Page with Search Parameter?
- Get array of current post term ID’s
- How do you query wordpress posts using a math formula between multiple meta field values?
- Custom Post order for homepage
- Change default ordering of taxonomy terms – pre_get_terms
- Page navigation doesn’t show when query category
- WP Query for variable taxonomies
- Pull post meta with post_query?
- How to access a query twice in different template files?
- Custom query for sidebar isn’t returning results
- Getting Taxonomy inside WP_Query Loop
- Complex WP_Query (two post types and multiple operators)
- Add quicklink to in the Admin posts page where I can query by a meta_key
- Remove category from query (show all posts in archive.php) pre_get_posts()
- Display Featured Post by Categories and Avoid duplicated posts
- WP_Query tax query part of slug
- How to use the query hook/filter?
- How to Union two different conditions in one WP_Query
- Order by empty custom field
- How do I exclude the lowest level terms in a taxonomy?
- No results found from a $wpdb->get_results() query when trying to join more than one meta key query
- Modify Search Query if original Query gave no results
- Yoast primary category query modification
- Loop posts based on permalink term
- Check if a post has term inside loop
- Write WP Query that selects posts that are part of the same two categories
- Include one page/post into query which is already returning posts
- Don’t repeat posts from children in parent taxonomy query
- Why doesn’t my WP Meta Query return any results?
- Show multiple tax_query from 2 or more post_type in a single code
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- Retrieve all term IDs of post
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Filter products on category AND tag
- Strange behaviour of hierarchical taxonomy archive
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- How to get meta key list efficiently?
- Why pagination is not working with tax_query param?
- WP_Query & Duplicate entries
- How to break up output of posts for different terms on same page?
- WP Query – Search in title or author_name
- URL to Post Archive of Custom Query
- Query by meta value (add a dropdown of all values)
- Query posts in current category but not attachment format
- How to query post into a complex slider
- wp_query – Modify $query to include duplicate content
- Optimising specific Query with ACF meta objects
- Horizontally paginate through sets of blog posts?
- Pagination not working with WP_Query (creates links but no page)
- Query custom post type by date field only working when two posts match the query
- Divide WP_Query posts by date & post type
- Query Posts by date range with fixed beginning and end
- query by meta value then date and not empty meta value
- New WordPress WP Query using posts from certain categories
- Multiple Orderby is not working right
- Use meta query only 3 or more results?
- Search results stuck on page 1
- Use value from meta key array for use in WP_Query
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2