How to make WordPress search prioritise page titles?

The standard search for WordPress works, but doesn’t seem too clever. If I search for ‘tomato’ and I have a page whose title is ‘Tomato’ I would expect that to come first in the results. However the results seem to be ordered by date published. So if a page/post mentions ‘tomato’ somewhere in the text, it will be first in the results if it was just published.

How would I make WordPress prioritise page titles in the search?

(I’m using the Starkers theme)

1
1

You can replace the default WordPress search with something more useful. As you have pointed out, the build-in search is very limited. So you’re not the first one with this problem. I suggest the following two plugins:

  • Search API (WordPress Plugin)
  • WordPress Sphinx Search Plugin (WordPress Plugin)

The last one allows to weight between parts of a post. But keep in mind that it needs you to configure and make use of Sphinx, a free open-source SQL full-text search engine.

Leave a Comment