Home › Forums › General Issues › Custom query filtering & ordering by ACF fields › Reply To: Custom query filtering & ordering by ACF fields
Honestly, I don’t know why it’s not working, unless it has something to do with the mix of meta settings. Try this
$today = date('Ymd');
$thePosts = new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => 10,
'meta_query' => array(
array(
'key' => 'event_end',
'value' => '".$today."',
'compare' => '>'
),
'date_clause' => array(
'key' => 'event_start'
'compare' => 'EXISTS'
)
),
'orderby' => array('date_clause' => 'DESC'),
'post_status' => 'publish',
));
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.