Support

Account

Home Forums General Issues Get Post by ACF DateTime

Unread

Get Post by ACF DateTime

  • Hello,

    I have a Custom Post Type called “Events”. This Post Type have a ACF-Field called “event_datetime” now i want to get all Events on a specific date. I do it like that:

    $date = $_POST["date"];
    $date = date("Y-m-d", strtotime($date));
    // date = "2017-08-03";
    
    $query = new WP_Query(array(
        "post_type" => "event",
        "meta_query" => array(
            "key" => "event_datetime",
            "value" => $date,
            "compare" => "LIKE"
        )
    ));

    But the problem is, that I every time get all the events…

Viewing 1 post (of 1 total)

The topic ‘Get Post by ACF DateTime’ is closed to new replies.