When I perform a search on the WP admin side for my custom post query I am returned with the most relevant queries first. Great

However, performing the same search on the front end of the site and I am returned with the same list but in reverse order. So I have to trawl through many pages to get the most relevant query. Terrible

I have a custom search template which I would remove but need for another "nearby' search function which works great.

Plugins like Relavanssi do not work and I have only cut-and-paste coding skills but it does seem like there may be avery easy solution here for someone in the know! not me


  • 1
    you probably just need to switch the order argument in your custom search template from ASC to DESC (or vice versa whichever the case may be.) – majick Oct 9 '19 at 12:39
  • If you're changing the search results in some way to support "nearby" results, then presumably you're sorting in ascending order so that closer items are returned first. If this change is also affecting regular searches then that would explain the behaviour. You need to change your search template (this type of logic doesn't belong in a template, but that's another issue) to only apply that change to these "nearby" searches. – Jacob Peattie Oct 9 '19 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.