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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.