In general this would make sense at pre_get_posts
since you could just express conditions as meta query and let WP figure out SQL.
In your specific case this won’t work, since that format is horrible for programmatic comparison. Unless you can change format to something more friendly, you will probably have to write some pretty custom SQL to make it work.
Related Posts:
- When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?
- When to use WP_query(), query_posts() and pre_get_posts
- How to print the excuted sql right after its execution
- Should I use Pre Get Posts or WP_Query
- Using pre_get_posts with WP_Query
- Pagination with custom SQL query
- Return only Count from a wp_query request?
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- What is “main query”? [duplicate]
- Prevent pre_get_posts filter on specific post type
- Reduce or prevent calling of update_meta_cache
- How to add taxonomy filter on the query fly?
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- how does $wpdb differ to WP_Query?
- How to uniquely identify queries?
- Order Search Results Page by meta_value If no Value Return Remaining Results
- pre_get_posts with get_posts
- Is it true $wpdb->get_results is faster than WP_Query in most cases?
- How-to exclude terms from the main query the most performant way?
- Changing Posts Per Page and offset with pre_get_posts
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- Order wp_query by calculated field
- Slow SQL_CALC_FOUND_ROWS Query
- Custom query incorrectly returning everything [closed]
- Extending WP_Query — Optimise SQL query
- “pre_get_posts” firing on every query
- RSS feed with specific keyword
- Use WP_Query with a custom SQL query
- Using is_main_query to select custom post type on certain page
- Multiple orderby parameters in pre_get_posts() action
- How to make an activities stream mixing posts and comments?
- SQL Statement generated by WP_Query not producing expected results
- How can I connect to another WP database and use WP_Query?
- How do I create my own nested meta_query using posts_where / posts_join?
- Sorting Posts by custom field
- How to use filter hook posts_join for querying taxonomy terms in posts_where?
- How to pass custom parameter to WP_Query for filtering in pre_get_posts
- Query with pre_get_posts to get pagination
- Recommended way to drop a pending query (in pre_get_posts)?
- How to search for posts IN OR title OR content OR author?
- Single page theme that uses pages for the content
- Get number of comments after modifying comment query
- How to change a custom query into a standard loop?
- WordPress custom search form with pre_get_posts not work
- If orderby parameter using pre_get_posts is the same for multiple posts what fallback does the query use?
- Can not switch the queried post in pre_get_posts hook
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- How to target the default Recent Posts and Recent Comments widgets with pre_get_posts?
- order by multiple meta keys in pre_get_posts
- Replace Main Query With Custom Query
- Should close $wpdb via $wpdb->close()
- How to sort posts in admin by titles with dd.mm.yyyy format?
- WP_Tax_Query with post_tag not working
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- How to Modify Taxonomy Archive Page with Search Parameter?
- Using pre_get_posts on a specific core/query block
- Searching through different categories on different pages code is not working
- $wpdb->insert inserting two rows in database
- How to display future posts – modified query still yields 404
- Get the Plugin Which Triggered a MySql Query in WordPress?
- pre_get_posts filter meta_query without conflicting existing meta_query
- Including only current user’s posts in search
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Detect featured image among the attached images
- How to change posts order on Category and Tag archives?
- How would I format a query that depends on post parent taxonomy
- Mysql query LIKE not working
- Select from wp_post and multiple meta_value from wp_postmeta
- Formulate a url to show posts with both taxonomy terms
- My Main Query Modification is Messing up my dynamic main – why?
- Order by custom table and multiplication
- Offset Page Loops and Pagination
- pre_get_posts Remove tax_query Completely
- How to correctly pass values to wpdb->prepare()?
- pre_get_posts order by not working
- Adding a parameter to the default query
- Using WP_Query in “parse_query” or “pre_get_post” in Posts2Posts
- $wpdb select date range of posts
- Single meta_query query using OR instead of AND in request’s WHERE statement
- What’s the purpose / logic of split_the_query in WP_Query->get_posts
- WPDB query – decrypting DB data
- How to choose between hooking into per_get_posts or into parse_query
- How to delete taxonomy term when a wordpress user is removed?
- Store sticky post’s ids in a transient
- How to change main query based on post meta
- new WP_Query to get max price meta value not working
- Display posts from only one post form in custom query and exclude in main query
- Show Sticky Post at the top but do not show again in the loop?
- WP_Query, pre_get_posts and offset
- Complex WP SQL Query
- Using meta_query with multiple keys and compare values
- Can I set my WP_Query to be a Main Query?
- Remove category from query (show all posts in archive.php) pre_get_posts()
- Custom Query num_rows returns wrong amount
- Show scheduled posts in main loop but not in WP_Query?
- Getting post revision and printing them on the post content site
- Filtering posts from different categories into different section by doing WP_Query only once
- Iterating through $wpdb query without using get_results for large query results
- hide custom post types with specific meta key ON admin backend
- WP_Query ignoring tax_query when is_singular