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…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.