Home › Forums › General Issues › Query between dates using Date Picker fields › Reply To: Query between dates using Date Picker fields
$all_events = array (
'post_type' => 'events',
'posts_per_page' => 50,
'status' => 'published',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'event_start_date',
'value' => array( $startday, $endday ),
'compare' => 'BETWEEN',
'type' => 'DATE'
)
),
);
I’ve tried this but it doesnt exactly work.
I saw in your documentation there is a way to query posts between dates. So i tried that, but it doesnt quite seem to work with what i want to do with it.
I have some events and i made a start event date and end event date fields. I want to query the events by the start and end dates.
The problem i have is lets say an event starts in May and ends in July. I have a page that lists the events by month. A page for May, June, and July. So this event that has a start date of May 1 2014 and an end date of July 28, 2014 should also show on the June page.
Do you have any options for getting the query to work in this way? It doesnt seem to be working.
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.