Home › Forums › General Issues › get_posts, filtering by acf date field › Reply To: get_posts, filtering by acf date field
Try adding this:
'order' => 'DESC',
'orderby' => 'meta_value',
Or if you don’t plan on adding more meta_query params, this format may work too:
$replaceme = get_posts([
'posts_per_page' => -1,
'post_type' => 'custom_post_type',
'meta_key' => 'custom_field_name',
'meta_compare' => '>=', // optional
'meta_value' => 'custom_field_value',
]);
I also don’t know the exact syntax but just play with it until it works. 🙂
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.