Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Fetch Record based on meta key dates

This is not possible, you cannot query sub-values of serialised/structured data in post meta values.

To fix this, you need to store the dates you want to query/filter by as separate post meta key/value pairs. Values need to be string/number/boolean whole values to be queried this way. They cannot be complex structures or sub-strings, such as JSON, arrays, objects

Also note that saving an array or object is a security risk. This is because you can’t save an array/object so WordPress uses PHP’s serialize function, turning it into a string. This exposes you to object deserialisation attacks.

Related Posts:

  1. how to make members list directory through wordpress post custom meta key.
  2. How do i create a custom post query when the meta value is an array?
  3. Getting attachments by meta value
  4. WordPress altering my custom query, How to fix it?
  5. How to make Meta Query case sensitive?
  6. Large AND OR query timing out
  7. Trouble with serialized metadata
  8. Query against multiple locations within single custom post type post
  9. Custom WP_query and integrating into theme file
  10. query post based on comparison
  11. Nested meta_query with multiple relation keys
  12. Can wp_query return posts meta in a single request?
  13. Use REGEXP in WP_Query meta_query key
  14. Meta query with string starting like pattern
  15. compare meta_query in get_posts arguments
  16. Query Multiple Post types each with own meta query
  17. meta_query where value is equal to given value
  18. Query Custom Meta Value with Increment
  19. Perform query with meta_value date
  20. querying with custom meta field with meta_query
  21. Meta Query with date and time on the same Day before given time
  22. Order by meta_value_num DESC and meta_value ASC on WP 4.0
  23. What is an efficient way to query based on post_meta?
  24. WP_Query not working as expected for attachments and custom meta_query
  25. How do I create my own nested meta_query using posts_where / posts_join?
  26. How can I create a WP_Query that returns posts where one meta_value
  27. WP Meta Query for some meta (array) values
  28. Querying by taxonomy vs Querying by Custom fields Speed Comparison
  29. How to get sum of meta_values of a meta_key in wp_query according to conditions
  30. How to query ‘posts_per_page’ to display a different blog posts index template?
  31. Order by meta_key in custom post type doesn’t affect the query
  32. How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
  33. meta_key and meta_value not working together
  34. Order posts by meta value and Date
  35. How add a custom posttype name using ACF field to a query post array
  36. Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
  37. Order Posts by meta value AND published date
  38. Query post with meta_query where date is not in future
  39. Get meta info related to current post
  40. Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
  41. Group WP_Query by meta_key date
  42. WP_Query last five posts, simply ordered by meta_value
  43. exclude posts with a specific custom field and value
  44. Performance when getting post meta for post retrieved by meta value
  45. Get attachment by meta_key value
  46. Display custom field meta outside loop, site wide
  47. Order post type by sum of two custom fields
  48. Conditional operator OR not working with custom fields
  49. Display posts with specific value first in query
  50. Get every post with value in meta key
  51. Posts query according to meta box date
  52. Order WP_Query results by meta key value in custom query
  53. Nested array issue in meta_query
  54. Display post meta conditionally based on it’s value
  55. add_query_arg to compare and display events from a certain date
  56. Show single posts date, in a page of posts
  57. Comparing 2 Decimal Numbers from custom fields and displaying posts
  58. Why doesn’t my WP Meta Query return any results?
  59. Query posts by searching for a string in a meta field
  60. WP_Query meta compare must include ALL array values
  61. WP_Query Class custom field parameters
  62. meta_query weird behaviour, static int will work, but not user data
  63. Query multiple post types, but different order for each
  64. Order by the first array within a meta_query
  65. Query ACF relationship field – Comparator IN – Value array
  66. ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
  67. How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
  68. wp query to use both author id and meta_query
  69. ElasticPress is (aparently) messing with my search filters
  70. WP Query – grouping posts by same meta key, adding together values from another key
  71. Meta query ignores multiple values of the key
  72. meta_query is overriding default search
  73. show most viewed post
  74. Query for current post
  75. Custom query to retrieve oldest post and retrieve others with date interval
  76. Comparing Meta Field date in WPQuery using Meta_Query?
  77. Use WP_query to match post types based on custom field values
  78. Why can my filter query SOME metadata but not other metadata?
  79. Getting posts by custom field value
  80. WP_Query, ACF field and array
  81. Problem with my loops
  82. How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
  83. Order by Date Custom Field
  84. I need query_posts() to order results first by a meta value and then by post ID
  85. Query by meta value (add a dropdown of all values)
  86. Order Posts By Custom Field That is an array of objects
  87. Orderby query does not work for custom fields even with meta query
  88. Saving custom fields for WP_Query to retrieve
  89. Meta key in wp_query bug?
  90. How to show all the associated posts with specific date of data metabox?
  91. WP Meta Query at depth 2
  92. Using custom field as ‘orderby’ value causing post grouping by publish date
  93. WP_Query Posts by Metadata from Option Tree
  94. Compare meta key separation
  95. Sorting Posts with meta value not working
  96. Return a single custom post from multiple meta queries
  97. Custom Search Query – include only custom fields and title
  98. query_posts with sorting on a custom datestamp
  99. How to query post ids liked by the Author
  100. Querying meta values within an array
Categories wp-query Tags custom-field, meta-query, post-meta, query-posts, wp-query
Print all the tags from a custom post type Please
Add custom HTML markup to Gutenberg RichText

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress