I'm looking for a solution that makes wordpress website's search result even better.

Question: By default, the search result will return all the not really related posts at first, as long as the post contained related words that meet the keyword which inserted in the search box while doing searches. For example: in the blog i have only 3 posts with different post titles and categorized in different categories. The 1st post title is "Exercise Makes Healthy Life", 2nd post title is "We Train to Be healthy"(which contains "exercise" in the post's paragraph only) and the 3rd post title is "Exercise Everyday is Good For Health".

1st post and 2nd post are same category as categorized in exercise. And then, the 3rd post is categorized in Health. Then, i entered exercise to search, the 1st and 3rd post will be displaying at first (because there is an "exercise" contained in the post title) and 2nd post will be displaying as last. I have a category named exercise as well.

Therefore, when people searched for a keyword that meets the category i have in the site, all the related posts in the category will display first. And then, display the rest of others posts.

Any solution? Thanks!

  • Check out the plugin Relevanssi, it massively enhances the default WordPress search, including searching for categories. – TheDeadMedic Apr 17 '15 at 14:14
  • Hi @TheDeadMedic , sorry that i forgot to mention in the question. I'm looking for the solution without a plugin. Would be preferable with a code that implemented into the file of functions.php. Possible? – Jornes Apr 17 '15 at 14:17
  • Why no plugin? It's easy enough to redirect to category archive if a search match is found, but changing the order of found posts based on category matches is no easy task, a bit outside the scope of WPSE. – TheDeadMedic Apr 17 '15 at 14:19

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.