ACF Date Compare
-
Hello,
I really struggle with meta_compare parameter. I have posts with ACF Date field [event_starts] and I try to filter events in between two dates (show event by months).
Filtering by “more” or “less” with one date works, but with two dates it shows all values or no values.
I try to show all post with ACF Date [event_starts] between October:
$start_date = '20191001'; // October 1, 2019 $end_date = '20191031'; // October 31, 2019 echo do_shortcode('[ajax_load_more post-type="post" meta_key="event_starts:event_starts" meta_value="'. $start_date .':'. $end_date .'" meta_compare=">:lessthan" meta_operator="DATE:DATE" meta_relation="AND" ]');I get only dates that are 2019-10-31 (but I have dates in between start/end dates), if I use meta_relation=”OR” I get all dates.
I think problem is with ACF Date format in database and $start_date value. ACF stores values in database without dashes (20191001).
Maybe someone can help me?
The page I need help with: [log in to see the link]
The topic ‘ACF Date Compare’ is closed to new replies.