Home › Forums › General Issues › Order custom posts by date picker field by $_GET query and by post_date › Reply To: Order custom posts by date picker field by $_GET query and by post_date
Well, that’s hard to say, and I don’t know exactly by looking at what you have.
You need to add a meta query with a clause and you need to add orderby in the format shown.
these are just some guesses, you’ll need to test. I’d have to build an entire site to test it myself
$query->set('meta_query', array(
'date_clause' => array(
'key' => 'text_date'
'compare' => 'EXISTS'
}
));
$query->set('orderby', array(
'date_clause' => 'DESC',
'post_date' => 'DESC'
));
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.