You are correct, this is not possible for serialised data. There are some hacks to try and get around this by searching for individual parts of the serialised string, but those throw up lots of false positives and can’t be sorted.
Generally, it’s an anti-pattern to store structured data inside a single meta value, and you can’t query the internal data in a meta_query
field. If you absolutely must store it, store it as JSON, but keep in mind you can’t query or perform logic on the contents. ( serialised PHP values also open you up to object deserialisation attacks, and break when naive search replace queries are ran on the database if the length changes )
The solution here is to separate it out into individual atomic post meta, at least 5, do the sorting in PHP/JS,or to create child post types to represent your events so that you can use the standard date time columns
Related Posts:
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999
- Making WP_Query limit results by date before today where date is a meta_query
- Create Shortcode shows only posts with custom_field meta
- WP Query Args – search by meta_key or title
- SQL query based on two different custom field values
- Using meta query (‘meta_query’) with a search query (‘s’)
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Max length of meta_value
- ORDER BY custom field value
- Can I query custom meta data through WP_Query
- Add custom fields to search
- Matching Serialized Arrays with meta_query
- Meta Query with AND & OR?
- How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
- get_pages sort alphabetically by meta value
- Trying to perform complex custom field query with order by set to field value
- Is there a way to do multiple ordering on a multiple meta_query?
- Assign/update the custom field value for all posts
- Order by custom field date with ASC order
- WordPress Search Custom Meta Field Only
- Compare meta_query decimals not working right
- Ordering posts by anniversary using only day and month
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- How to break meta values into different items and avoid duplicates?
- Slow meta query with multi meta keys
- Using OR in WP_Query negates the “NOT EXISTS” compare
- How can I query on the year part of a complete date in a custom field?
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- Displaying posts with only upcoming dates according their custom field date value
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Sorting posts by multiple values, combined
- meta_value_num sort glitch
- WP_Query display next custom post from today’s date
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- WP_Meta_Query causing long-running MySQL queries
- Sorting posts by custom fields in meta_query
- meta_query for a string inside a meta field containing a comma-separated list
- Order by custom field value not working for acf date field
- How to sort category by custom field value
- trim custom field text value and show (…)
- Complex WP_User_Query call fails on production server
- Query post order by post and desc not working
- Meta query with timestamp using WP_query
- Orderby custom field meta value ASC and then by date DESC
- How to wrap meta values seperated by comma in ? [closed]
- How to create a Custom Meta Box with Name/Value Admin User Input Fields?
- How make a custom search on backend in WordPress without plugin?
- How to add a new meta key and assign timestamp to posts
- Get content from pages with same meta_key from Database
- Run a check for multiple meta key values
- Filter by custom field (meta_key) using JSON API
- WP 3.1 meta_query for multiple custom field values
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Removing link ” from ” on meta_value in custom feilds
- Get posts with same meta value as current post
- Alter main archive, to show posts with meta as last
- Meta Query returns wrong number of posts
- Sort alphabetically by custom field
- Change order of posts
- Meta Query And/Or
- Use meta_query to get title of associated post
- Meta query with multiple custom fields for archives page ordering problem
- filter custom field values $min $max
- Ordering posts by custom field named “date” in backend
- Get Data From wp_sitemeta for Multisite network
- Unique meta_key with array value vs repeated meta_key with single values
- get posts where a custom field contains a text
- WP Query – Is this correct?
- How can I do a variable for meta_query?
- Avoiding ACF get_field and returning to core WordPress function
- pre_get_posts : only get posts by wp_usermeta value
- ORDER BY custom field value out of where clause
- comment meta_query for keys that aren’t yet set
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- meta_value and meta_key filtering returning no posts [closed]
- IF Custom field value equals ZERO
- List custom field values in alphabetical order without repetition
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- How to update a custom field in all posts with the value of another custom field in the same post?
- Update post meta custom field using block editor
- How to add custom filed value after in wp post title
- change order of images attached to post
- Sortable Custom Columns not sorting correct
- Meta_query ‘compare’ => ‘LIKE’ not working?
- Diamond question mark in text after migrating content
- query_posts with meta_value
- tax query between operator like
- Show array of meta_value in Edit Post Coloum
- Best way to sort estates and query them (for rent? yes/no. contains office space? yes/no)?
- Is it possible to compare the current time with a custom “start” and “end date
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- multiple meta_query and orderby question
- User query – getting values for custom meta keys/fields
- Woocommerce products search with custom fields
- How to save multiple values with same meta_key, each value linked to another tag id
- How to improve my non-unique metadata MySQL entries?
- Set class if a meta value is set within post archive