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
- 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
- Select All in Parent Category, Group by Child Category?
- Filtering a WP_Query meta_query by numeric values isn’t working
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- How Can I save multiple records in same meta key?
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- I can’t set meta_key in my custom post type query
- Compare 3 custom fields and sort by oldest
- Using Query Posts With Multiple Post Types And A Taxonomy
- WP_Query post at custom position
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Combine tax_query and meta_query in WP_Query
- Query for posts from any post type but only add instock products
- Re-order posts in query after
- Filter posts with meta_query NOT IN where value has multiple values
- Display custom post types with custom date field value (before today) & order by custom date field
- Displaying Metabox value (custom post type taxonomy)
- How to query different post types in specific order?
- Filtering by Post Meta Custom Fields – Performance
- orderby in custom WP Query does not work
- Combining sorted and random CPT
- Setting proper query for multiple custom admin filters
- 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
- Display custom post type from dynamic custom field
- 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
- 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
- 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
- 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?
- Two queries – one with checkbox ticked, one without – comparing meta_query
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- 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?
- 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
- Orderby if between two meta fields
- How to sort by multiple values in a nested WP_Query
- SEARCH QUERIES – REVERSE OUTPUT
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- How to get post by meta value
- Sort custom post archives by a meta value from a different custom post type?
- 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
- How to get post meta for custom post type and taxonomy
- 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
- meta query always fails even if data is correct
- shortcode order for event custom post type
- Selecting posts older than the current Unix epoch timestamp
- Values inside a custom field to determine which category posts to display
- Trying to combine multiple WordPress queries
- 404 on Pages for Custom Post Type & Query_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