Home Forums General Issues Sort CPT with multiple dates Reply To: Sort CPT with multiple dates

  • Does each Course have a repeater field with multiple dates in it or have you created multiple courses with the same name that have a different date assigned to them?

    You could do something like this to get all courses after today:

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

    Note: the ‘key’ would be your ACF field name that contains the date. You may need to adjust the format of the date.