Meta Query with date and time on the same Day before given time

Found the error:

$args = array(
        "posts_per_page" => 12,
        "paged" => $paged,
        "post_type" => array(
            "event",
            "post"
        ) ,
        "post_status" => "publish",
        "meta_key" => "_thumbnail_id",
        'meta_query' => array(
            'relation' => 'OR',
            array(
                'key' => 'event_start',
                'value' => date("Y-m-d H:i:s") ,
                'compare' => '>=',
                'type' => 'DATETIME'
            ) ,
            array(
                'key' => 'event_start',
                'compare' => 'NOT EXISTS'
            )
        ) ,
        array(
            'key' => 'foreign_language',
            'value' => 0
        ) ,
        array(
            'key' => 'hide_from_most_recent',
            'value' => 0
        )
    );

It must be DATETIME instead of DATE as comparing type.

Leave a Comment