Support

Account

Home Forums General Issues get_posts, filtering by acf date field Reply To: get_posts, filtering by acf date field

  • Unforunately the filtering still does not work:
    I have now:

    
    $startDate = date('Y-m-d H:i:s', strtotime('-2 days'));
    
    $posts = get_posts([
    		'post_type' => 'veranstaltungen',
    		'post_status' => 'publish',
    		'order' => 'DESC',
    		'orderby' => 'meta_value'.
    		'meta_query', array( array( 'key' => 'event_date', 'value' => $startDate, 'compare' => '>=')),
    		'numberposts' => -1,
    	]);
    

    But I would still get all my events displayed. Also clearly the ones that have an event_date smaller than the $startDate

    What would I have to add to get i to work?
    Is it really possible to compare

    2019-11-20 19:30:00 >= 2019-12-02 10:43:05

    I feel like that is not gonna work…