Fortunately, this complicated database query is no longer needed. WordPress 4.1 added the ability to make complex nested meta queries which is exactly the thing I was trying to accomplish.
Here is the Trac ticket with the feature: https://core.trac.wordpress.org/ticket/29642
Related Posts:
- WP_Query Performance Issues with meta_query
- Get the post permalink within the loop but without additional DB query
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Is it possible to query from external database? [duplicate]
- How to set up hierarchical relationships without using plugins / meta query
- How to get meta key list efficiently?
- wpdb get_results() returns only 2 rows
- WP_Query always returning the last custom post
- Return only Count from a wp_query request?
- Make a WP Query search match exactly the search term
- WP_Query: query posts by ids from array?
- Query WooCommerce orders where meta data does not exist
- pre_get_posts with get_posts
- author.php with ACF and CPTs
- Query Custom Meta Value with Increment
- Identify which loop you are hooking into; primary or secondary?
- How to make an activities stream mixing posts and comments?
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Show only oldest post by author
- How to get the posts published in last two days using WP_Query?
- Finding the next 5 posts
- Dynamically Override Fancy Title – Part II
- Transient pagination not working properly
- Can not switch the queried post in pre_get_posts hook
- view queries made?
- Pass the same object to multiple widgets in a template with one query
- List the 5 most recent child pages
- What is considered a default query for the request filter?
- $wpdb insert is not work
- How WordPress attaches its Featured Images with posts?
- How to find exact match for search term in WP_Query? What is the additional string added in LIKE query in WP_Query?
- Query total number of posts
- Creating a custom search for a specific post type
- How to query a custom post type with a taxonomy filter but display post type archive page?
- Custom query for sidebar isn’t returning results
- Query custom post type by custom taxonomy (category slug)
- Change query_posts to WP_Query in page but does not work
- Optional Meta Query
- Set conditional on template based on referring page slug
- Iterating through $wpdb query without using get_results for large query results
- Filter posts in category archive page by year using a dropdown
- Query posts intersecting tags and categories
- How to implement a new row_count method in WordPress?
- Include data from custom table in WP_Query
- Meta Query relation “AND” then set array accordingly
- How to get a query variable?
- date_query seems to be ignored by wp_query
- Better wordpress attachment query than this
- Is_single() conditional tag returns null in query
- Can’t sort custom post type by random
- Query posts that contain video?
- List of ways to access WordPress database?
- Show a 404 error page if Public query variable’s value doesn’t exist?
- Specify strict ‘order by’ in WordPress query
- Set front_page programatically after user login via query, while leaving site option alone
- Does WordPress have something like Drupal’s DB API?
- Why having more than 10 clauses in WP_Query results in some outputs being dropped?
- mysql query order by
- Notice thrown when creating numeric pagination on custom query
- wordpress udpate query not equal to
- WP Query – filtering terms with regex
- Issue with data array format
- meta_query where the meta value is not the post title
- Multi-layered WP_Query
- `offset` WP_Query argument dont work via `pre_get_posts`
- Pagination of custom page with custom fields query
- setting offset to category number in archive page
- Woocommerce Get Orders By Meta Value
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- wp query search multi terms
- Translating WP query into to SQL query
- Query Posts | Combining multiple form inputs into query arguments to generate one filter result
- How to query 5 users in random who have published more than 10 posts
- WP_Term_Query->get_terms() very slow query for WordPress filter
- Is my code correct?
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Meta query doesn’t remove placeholder escape before query
- How to show post title in content editor in backend?
- What is the best way to reset a search on a meta_key / meta_value?
- How can I modify standard search query to include also ACF custom fields values?
- Bring a post to the top of the query if it’s in a certain category?
- WP_Query with child element
- Using URL variables on a custom WP_Query
- Website goes slow down after importing long database
- How to get query results for the next page
- Using WP_Query to re-query and sort results using a date?
- Pagination is not working on custom query inside a custom home page template
- Loop through multiple custom fields with increasing number
- How to organize a WP_Query’s list of posts by category and display category title?
- Need help setting up a search form for wordpress [duplicate]
- WordPress Query showing multiple titles
- custom query to get posts
- confirm my booking with phone number
- Get WP_Query query after execution?
- shortcode using multiple WP_Query’s with multiple category names not fully functional
- WordPress query very slow on +/- 300k DB entries and 7 INNER JOIN
- 294 Queries on Mainpage of WordPress
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- wp_query order by rand is repeating posts