Home › Forums › ACF PRO › Sort post by acf date first and after by title › Reply To: Sort post by acf date first and after by title
It is not possible to short the posts in the way that you want to sort them. In MySQL empty strings are less than non-empty strings. When sorting in ASC order they will always come first. If you use number as the data type the value would be 0 (zero) again lower than any post with a date.
There are really 2 choices
1) ensure that every post has a value
2) do 2 queries, first get all posts with a value and then get all posts with empty values.
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.