Home › Forums › General Issues › Sorting woocommerce products by ACF Date Picker field › Reply To: Sorting woocommerce products by ACF Date Picker field
The date field is not a sub field, its only grouped with some other fields. I have checked into DB and the date_end field is stored like I mentioned in this format: 02/April/2022
I’m sending you an image of the wp_postmeta table to see how it is stored:
That’s why I’ve used this line of code, to remove the backslash and transform the date into Ymd format, but it still isn’t working:
$args['orderby'] = date('Ymd', strtotime(preg_replace("/\//", " ", 'meta_value')));
To mention that the latest upgrade was from 4.4.2 to 5.11.4.
I really ran out of ideas how to solve this issue.
Thanks for the help.
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.