Support » Plugin: Date and Time Picker Field » Posts not sorting by time field

  • Sean M.


    Hi, I can’t get posts to sort by the time field regardless of format used. I checked the values being saved to the DB, by enabling custom fields for the post type and verifying the value stored and they appear to be correct UNIX timestamps.

    What I’m experiencing is that the posts sort by numerical value (e.g. 12:00 PM comes after 6:00 PM) and despite trying even using a ‘meta_query’ alongside the typical ‘orderby’ with ‘meta_key’ and ‘meta_value_num’, I can’t seem to get the posts to sort correctly. Not sure what I’m doing wrong. Here’s an example of the query I’m running:

    <?php $args = array(
    	'post_type' => 'saturday_event',
    	'orderby' => 'meta_value_num',
    	'meta_key' => 'start_time',
    	'order' => 'ASC',
    	'nopaging' => true
    query_posts( $args );
    while ( have_posts() ) : the_post(); ?>

    Anybody know what might be wrong here? Thanks for your help!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Posts not sorting by time field’ is closed to new replies.