There is an interesting answer on SO which present different methods to resolve that issue: How do I query for posts by partial meta key?
- By custom SQL query (in my project I’ve used that solution)
- By changing the meta schema to store the dynamic
meta_key
as ameta_value
- By using the
posts_where
filter to update query behaviour based on input
Related Posts:
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Custom WP_Query order by post_meta and (author) user_meta
- Query WooCommerce orders where meta data does not exist
- Perform query with meta_value date
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Meta Query for specific months
- How to orderby meta_value_num with dollar ($) sign
- Optional Meta Query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- How to orderby multiple meta fields if some fields are empty
- Meta Query relation “AND” then set array accordingly
- How to set up hierarchical relationships without using plugins / meta query
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- meta_query where the meta value is not the post title
- Query multiple post types, but different order for each
- Woocommerce Get Orders By Meta Value
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Meta query orderby meta_value_num sorting by role first
- Query against multiple locations within single custom post type post
- Strange results from WP_Query
- WP Query. Ordering posts by another post types meta
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- 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?
- Filter posts/pages by user_role array
- Use meta query only 3 or more results?
- Use value from meta key array for use in WP_Query
- Display products from specific category in shop page
- Meta Query with AND & OR?
- How to uniquely identify queries?
- How to make an activities stream mixing posts and comments?
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- How to query for a week using key => value WP_Query argument notation?
- Query by meta_key and order by meta_value_num return orderby date
- WordPress altering my custom query, How to fix it?
- Comparing timestamps in meta query doesn’t work
- Order by meta_key in custom post type doesn’t affect the query
- How to create/modfiy WP_Query to search in post title OR custom field?
- How to detect custom query inside `posts_where` hook?
- Is temporarily overwriting $wp_query a bad idea?
- How to output different posts per page?
- Multiple meta queries but arrange by specific meta value order
- Order Posts by meta value AND published date
- Pass array of taxonomy terms to wp_query
- What format does the meta_query TIME type require?
- pre_get_posts order by not working
- How to reduce the number of queries?
- WP_Query filter and order by meta ordering by wrong joined table
- WP_Query last five posts, simply ordered by meta_value
- List of the years with posts presented
- What is the random string I am seeing when I use get_query_var?
- Query custom post type by custom taxonomy (category slug)
- Editing the default wordpress search
- meta_query in WP_Query value is not accepting array
- Slow page loads due to WordPress Core Query
- Set global $wp_query/$post variable for dynamic page generation
- Changing sort order for presentation by Jetpack infinite scroll
- get posts by meta_key from inside key of post meta
- Help optimizing slow WP_Query with meta_query
- meta_value_num not ordering all items
- Meta Queries – should nesting work after WP 4.1?
- Filter and Order by Multiple Custom Meta Values
- Query with meta_query and tax_query together not working properly
- Is_single() conditional tag returns null in query
- Is it possible to query a custom field where the value is between two fields?
- Filter posts by comparing custom meta value against postdate
- Query posts that contain video?
- Show a 404 error page if Public query variable’s value doesn’t exist?
- meta_query fails to compare on values containing apostrophes
- Set front_page programatically after user login via query, while leaving site option alone
- Check if searched number is within the post meta value
- How to hide posts of a specific custom category in WordPress?
- mysql query order by
- Notice thrown when creating numeric pagination on custom query
- How to SQL query posts IDs by categories AND authors?
- WP Query / Meta Query [duplicate]
- How to add date_query to meta_query array
- Order by the first array within a meta_query
- Combine query in WP_User_Query()
- Multiple nested meta queries
- How can I modify the query by adding to the existing query?
- WordPress Query custom ordering by temporary variable
- Comparing Meta Field date in WPQuery using Meta_Query?
- How to create better WP_Query to look for date time which is anywhere between two meta values?
- How to get_comments() ordered by date and parent?
- compare for multiple meta values for same key in wp_query
- datetime picker, timestamps and meta queries
- WP_Query with meta_query won’t orderby
- Adding Category in WP_Query Not Working
- Fetch only categorized posts
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Looking for a way to exclude frontpage and nav menu from query filter
- Showing posts from 4 categories along with all latest posts
- Get posts by meta value except one post [closed]
- How do I have multiple metaqueries inside one wordpress query
- Display only posts with thumbnails