Home › Forums › Backend Issues (wp-admin) › Sorting search results by ACF date fields › Reply To: Sorting search results by ACF date fields
Hello John
Many thanks for the advice. I have corrected the spelling mistake in is_search.
The explanation regarding the sorting explains exactly what I see in the output of the search results after sorting by date.
What I still don’t understand is that the sorting works when querying the two cpts on an overview page (first code section) but not in the search.
Can I rewrite the search query so that sorting by date works or would ACF fields have to be named the same in order to enable sorting with $query->set('orderby', 'meta_value'); $query->set('meta_key', 'date_field_name');
?
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.