After multiple research I didn't find the correct answer to my question.

I just need to order my custom post type by date and then by time (format: 18:00).

Here's what I tried: http://pastebin.com/BRR6h08j

It orders well by the date but not by the time. And I don't need to hide events that occured.

If someone can help me getting my correct meta_keys

I know the problem is here:

'meta_query' => array(
     'relation' => 'AND',
        'key' => 'heure_de_lartiste',
        'value' => $todaysDate,
        'compare' => '>='

I don't know what to put in "value" and "compare"

Thanks a lot,


2 Answers 2


I don't understand why can't you use the post_date of the custom post type which includes date and time together?

 $arg = array(  
    'post_type' => 'custom_post_type',
    'orderby' => 'post_date', 
    'order' => 'DESC')
 $result = get_posts($args);

Cuz it is not the post_date I want to show but my meta_key called 'heure_de_lartiste' that are not the same !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.