Display posts between two dates meta_query wordpress
Question
I have two custom fields (advanced custom fields) of "start_date" and "end_date", I want to filter the projects that are between the two given dates, here is what i’ve tried:
array(
'key' => 'date_start',
'value' => array($date_start_formatted, $date_end_formatted),
'type' => 'DATE',
'compare' => 'BETWEEN',
),
and also:
array(
'key' => 'date_start',
'type' => 'DATE',
'value' => $date_start_formatted,
'compare' => '>=',
),
array(
'key' => 'date_end',
'type' => 'DATE',
'value' => $date_end_formatted,
'compare' => '<=',
),
Is there a way to find all the project dates that fit between these two dates, for example,
date_start filter = 05.05.2020 and date_end filter = 20.05.2020
but project is date_start = 04.05.2020 and date_end is = 19.05.2020
this project still shows up after filtering, due to the fact that the project happens between the dates even tho that the date_start is before the set filter
0
1 month
0 Answers
8 views
0
Leave an answer
You must login or register to add a new answer .