Home › Forums › General Issues › How to filter posts by event month › Reply To: How to filter posts by event month
I would think of something dynamic. How are you setting the month? I was assuming this was one query based on the link parameters or something else where month and year would be determined before the query.
$month = 'some code to set month';
$year = 'some code to set year';
then in the query
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'event_date',
'value' => $year.$month.'01',
'compare' => '>=',
),
array(
'key' => 'event_date',
'value' => $year.$month.'31',
'compare' => '<=',
),
),
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.