WP_Query() show posts that end later than today

First, your date format has to be in descending order from largest to smallest units, i.e.: year, month, day, hour, minute, second, etc., otherwise MySQL can’t query or order on the field. In this example I use year – month – day:

$today = date( 'Y-m-d' );
$args = array(
    'post_type' => 'vehicle',
    'meta_query' => array(
        array(
            'key' => 'end_date',
            'value' => $today,
            'compare' => '>=',
            'type' => 'DATE'
        )
    )
):
$query = new WP_Query( $args );

Leave a Comment