I would advice you to store the time as a string instead of a d-m-Y
format. Use strtotime()
to format it as a long integer. This will help you comparing the strings. I’m not 100% sure if PHP is able to compare string dates. It is however able to compare timetamps as this user mentioned as well: How to compare dates and strings in PHP
Related Posts:
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Filtering by Post Meta Custom Fields – Performance
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- Possible to filter custom post type with multiple meta data?
- Query based on custom fields start and end date
- Getting a custom post’s custom field based on another custom post’s custom field select
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Meta_Query refuses to return results
- Query events post type after current date and timezone
- Selecting posts older than the current Unix epoch timestamp
- Querying meta values within an array
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- WP_Query not using relation key as expected and not producing any results
- WordPress custom loop filter by meta_key and value with serialize data
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- How can I get the number of custom post type posts that have a specific attachment image set?
- Problem querying Custom post type by custom fields
- Orderby CPT custom fields not working
- WP_Query order by custom field, then randomly order some of results
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Query custom post type with ACF Date
- How to do WP_Query with two meta fields with orderby clause
- Stuck in Order by more then one
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Including metaboxes from custom post types in global search — continued
- Query Multiple Custom Posts by Custom Fields
- Why is this query not working? (Standard posts + custom post type)
- Get Posts by multiple custom fields is not working
- Order Custom Post Type by Custom Field Value
- First custom field value (out of several) displayed twice after query
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- Configuring a meta query with multiple post types that have the same relationship on a single page
- How to Output which matched meta_keys were found from custom_type_posts?
- filter search custom field query
- How to let users choose where to search for posts?
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- WP Query ‘posts_per_page’
- Display post from a date range from custom field
- post_per_page ignored in WP_Query
- WP_query – Filter by tax_query and meta_query using multiple select
- How to get specific post meta by title or id
- WP_Query orderby not work with meta_key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- find custom post type post by searching its custom field with my string
- WP_Query of custom post type sorted by meta_key has unexpected results
- Custom Query: If One Post Object Field Value Is The Same As Another
- Display custom post type for specific user
- Custom Post type loop with ACF not displaying properly
- Create a WP_Query where if the first value of the first row is equal to the second compare other value
- Group by custom field value (start and end times)
- Query Posts, order by meta value
- WP_Meta_Query object with conditionals
- Sorting by meta_key different to search criteria?
- Using WP meta query to show custom post types by a start and finish date
- Two queries – one with checkbox ticked, one without – comparing meta_query
- Cache issue with WP_Query and custom field filtering
- How do I list a custom field and custom taxonomies for each result in a loop?
- WP query_posts group by meta field related
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- order the meta query results by 2 custom fields
- Custom Form / Search with Custom Post Type Data
- Create if else for post types in WP_Query ‘post__in’ values
- WP Query from two Custom Post type fields as statement
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Using OR relation in meta_query to check for a value before sorting by another
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- WP_Query get always custom post_type for first
- Sort custom post column by generated value?
- build child and anchestor three from post parent
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- meta query condition don’t work
- How can I query and sort custom-post type using WP_Query
- Custom query result empty on page 2
- Meta query and compare “!=” not working as expected
- Orderby if between two meta fields
- Use WP_query to match post types based on custom field values
- Filter posts by their related field’s custom field
- Show posts from WP Custom Post Type selected from a field in a metabox
- How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?
- Query custom post type and custom field by URL parameters
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Query a Custom Post Type using SELECT that has ACF fields to compare dates
- Post Filtered by Custom Field Value
- Filter custom WP_Query by first letter of a custom field – hopefully using Search and Filter Pro?
- post type => ‘any’ not applied my custom queries
- sorting in wp query based on custom field value
- How to get the posts that my following users are liked?
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- Not able to get my custom search result using meta_query and tax_query together?