I think the issue is that it’s being interpreted as a STRING type and being ordered character by character. Maybe try turning this into a meta query and forcing the DATETIME type like the example shown below:
'meta_query' => array(
'starttime' => array(
'key' => 'start_time',
'type' => 'DATETIME',
)
),
'orderby' => array( 'starttime' => 'ASC' ),
Related Posts:
- Ordering posts having multiple post-meta date fields
- Can’t sort order of wp_query with 2 meta keys
- query order by date on custom type: wrong order
- How to do WP_Query with two meta fields with orderby clause
- WP_Meta_Query object with conditionals
- Use WP_query to match post types based on custom field values
- Querying meta values within an array
- Order Wp Query by earliest of 3 dates meta query
- Query all posts where a meta key does not exist
- Meta query with boolean true/false value
- Get post with multiple meta keys and value
- Mixing regular and custom post types (with meta_query) on home page
- WP_Query() show posts that end later than today
- Sort Order for a Custom Query in a Post Type Archive Not Working
- WP_Query orderby custom field then post_date in one query
- wp_query check if integer exists in custom field’s array
- Previous/Next Link by Meta Value in CPT
- Get posts between custom dates
- Wp_query: sort by PHP variable
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Stuck in Order by more then one
- Why is this query not working? (Standard posts + custom post type)
- WordPress request fiter order by related post’s post_title
- Order Custom Post Type by Custom Field Value
- Change sort order when using ‘orderby’ => ‘type’
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Ordering custom post type by multiple custom fields
- Possible to filter custom post type with multiple meta data?
- Query based on custom fields start and end date
- Displaying a div from an assigned meta_value when on a page
- WP_query – Filter by tax_query and meta_query using multiple select
- How to get specific post meta by title or id
- Getting a custom post’s custom field based on another custom post’s custom field select
- 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
- $post->post_meta not pulling any post in wordpress/php
- Returning a custom content types with meta values
- WP_Query not resetting after wp_reset_postdata
- Create a WP_Query where if the first value of the first row is equal to the second compare other value
- Post ordering not working with custom field
- Query Posts, order by meta value
- 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
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- Displaying Portfolio Filter by Category Order (alphabetically)
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
- Display Parent-Child Posts in specific order by comparing IDs in array
- How can I sort the results of a REST API response by the title of a connected custom post type?
- build child and anchestor three from post parent
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- meta query condition don’t work
- Custom query result empty on page 2
- Orderby if between two meta fields
- How to sort by multiple values in a nested WP_Query
- Show posts from WP Custom Post Type selected from a field in a metabox
- SEARCH QUERIES – REVERSE OUTPUT
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- meta query multiple values for the same key
- How to get post by meta value
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- Wp Query sort order from custom MetaBox
- How do I get all authors posts of a custom post type outside loop
- post type => ‘any’ not applied my custom queries
- How to get the posts that my following users are liked?
- Meta_Query refuses to return results
- Linking posts together with Advanced Custom Fields “both ways”
- Not able to get my custom search result using meta_query and tax_query together?
- How to get Current week and current date record wp query
- How to get post meta for custom post type and taxonomy
- Querying, storing, and using data from 2 separate custom post types
- get_post_meta for Custom Post Type ( CPT )
- Query events post type after current date and timezone
- WP Query with multiple post types ordered by custom meta date then published date
- Conditional posts in WP_query for search
- Orderby modified only for specific post types
- Custom post order when using OR relation
- meta query always fails even if data is correct
- WordPress custom post type
- shortcode order for event custom post type
- Selecting posts older than the current Unix epoch timestamp
- Custom Post Type meta oembed html output resulting in WSoD
- Values inside a custom field to determine which category posts to display
- Custom Query With Multiple Meta Key Value
- Trying to combine multiple WordPress queries
- 404 on Pages for Custom Post Type & Query_Posts
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- WP_query orderby not working after WP4.0 update [closed]
- Check for custom field value in different post type than current one and do something
- Query order by meta value force specific tag first
- WP_Query() displaying past post / event
- WP Query Conditionally query meta and taxonomy
- WP_Query not using relation key as expected and not producing any results
- WP Query filtering by custom category not showing all relevant posts
- getEntityRecords/useEntityRecords: How to use CPT metadata?
- Quering a post object based on another related post object
- Query multiple post types – Order by type and post title title