Nested arrays can be used to create complex Meta Query’s.
An example of how this would apply to your situation.
$meta_query_args = array(
'relation' => 'AND',
array(
// Conditions
),
array(
'relation' => 'OR',
array(
// Conditions
),
array(
// Conditions
)
)
);
For more information check: https://codex.wordpress.org/Class_Reference/WP_Meta_Query
Related Posts:
- How do you get posts by meta_query using the JSON API plugin?
- Problem with get_posts, tax_query and counting the number of posts
- meta_query date and time comparisons
- Meta query: get posts with value in a multidimensional array
- get_posts( $args ) return empty data
- Get all posts with a certain meta key, except for one with specific title
- How do I get posts by multiple post ID’s?
- What does setup_postdata ($post ) do?
- Query for custom post type? [closed]
- Why get_posts are only showing five posts (retrieved by assigning a category to them?
- Exclude Current Post from Recent Posts Loop
- get_post random and order by not working
- Alternative to get_posts() due to multithreading cache crash
- tax_query in get_posts() not working?
- How to get current post ID in quick edit callback
- Does tax_query really beats meta_query in all situations?
- How to restore deleted pages/posts?
- Query all posts where meta value is empty
- Why favour the standard WP loop over iterating over (new WP_Query())->get_posts()?
- get_posts not honoring post_status
- search query within custom taxonomy term, post title and meta field
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- get_posts cannot grab from specific category
- Combine tax_query and meta_query in WP_Query
- Check If posts exist in custom post type category, outside of loop
- Serialized array, grab specific posts with meta_key/meta_value[0]->is_featured
- How do I combine these 2 queries
- get_posts gives different result than wpdb->get_results
- Query for custom post type objects in a taxonomy and with a meta value
- Trouble using get_post
- Cache Get_posts
- Use both meta query and tax query
- Secondary Query Is Breaking Main Query
- `get_posts()` ignore my custom post
- Tax query clause inside a meta query clause?
- I don’t arrive to do order_by title when i have a conditionnal year in a request
- How can I display a single post link, based on title sample and change monthly?
- Using get_posts() with tax_query parameter set isn’t working with attachments
- get_posts() doesn’t consider user permissions
- Better way to list links with different meta values using same meta key?
- Searching in title or meta, with a tax query too!
- Meta Query returns wrong number of posts
- How to get the post content from a category on my homepage
- get_posts() not working in functions.php
- Get all pages and posts with get_pages() or get_posts()
- Display post details by post ID
- What is the p parameter in a get_posts() parameter array?
- Query with meta_query and tax_query together not working properly
- Inserting post content into pages when using custom taxonomies
- Query get_posts by level depth
- meta_query: check if number exists
- Get posts in between specific ID’s
- How to use WordPress Conditional Tags in get_posts foreach loop
- Don’t submit post if post title exists
- Hide gravity forms
- Why would get_posts be ignoring posts with 2-digit ids?
- Order custom post type by custom field (created by PODS) via PHP
- get_posts returns all posts
- Check if searched number is within the post meta value
- Is it possible to add relation between meta_query and tax_query?
- WordPress Random post (last 3 days posts)
- Cron task firing but function not working
- wp json api – get posts by category
- Can’t get Category link inside get_posts
- List all pages including archive
- Yet another get_posts() in explicitly defined order problem
- List random posts on single page in the current category
- WordPress echoing content in seemingly random place
- How to add date_query to meta_query array
- How to use get_posts to filter against a single post id?
- Facing problem with tax_query results
- Tax query get first product with attribute value in pre_get_posts
- WP get_posts meta_query using ACF repeater field
- Why set cookie from URL parameter doesnt work all the time?
- get_posts filter meta_query using ACF Checkbox
- Is there a way to extract a single post better than using get_posts()?
- Array merging multiple get_posts throwing Undefined offset error
- get_posts returning empty array
- Update all WordPress posts’s title and content then display them in a table
- get_posts – check if custom field has content?
- Get Posts from Custom Meta Query
- WP_Query to get posts in a specific tag or has post_format
- Why does ‘meta_key’ return an empty array in get_pages
- Not able to get my custom search result using meta_query and tax_query together?
- Error get_posts with Custom Taxonomy and OR relation
- Slow query when selecting with large meta query or post__in
- How to exclude posts with empty and non-existent relational custom field with meta_query?
- Get number of posts in each category since last visit
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- Get_posts not returning any posts when used with switch_to_blog
- How to Retrieve Post ID of another page
- WordPress – List Sub Categories and Sub-Sub Categories, With Posts
- How to show only 1 post from a specific category on the front-page
- Query for draft or scheduled post
- get posts based on category and post meta
- How to show only text from post in WordPress
- Install wordpress and replace database (from previous site)
- WordPress extremely slow when using get_posts with multiple meta_query relations
- WP Query Conditionally query meta and taxonomy
- Complex Taxonomy scheme