Home › Forums › ACF PRO › Custom loop in ACF block › Reply To: Custom loop in ACF block
Hey @anybodesign
You should able to do that via get_posts() too.
The most problem you don’t use the proper order value for that.
I think you want to change the ‘order’ like this:
$posts = get_posts([
'post_type' => 'product',
...
'meta_key' => 'your_date_field',
'orderby' => 'meta_value_num',
]);
The key is the meta_value_num when you order by number / date type of fields
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.