Help people find posts on your blog or website with a powerful WordPress search plugin. Enable your WordPress search page to show the results people need with this step-by-step guide.
Does your website have a search box to enable people to find interesting posts on your website? If it doesn’t, how will people find things? It would be very slow, tedious and hit and miss to try to find something through the menus. That is assuming every post is on a menu.
Sometimes search is the only way to find posts and it is an essential feature that every website should have. It makes it easier for your visitors.
Fortunately, there is a basic search built into WordPress and it works in the sidebar. Below is a step-by-step guide showing how to add it (you must have a sidebar).
After adding a search widget, it is then turbo charged with a WordPress search plugin that makes it even better. It works with the built in search but it produces better results for your visitors, such as sorting by date or relevance, finding partial word matches, and more.
1 The WordPress search widget
Go to Appearance in the sidebar and select Widgets. Look for the Search widget, it is there somewhere.
2 Add search to the sidebar
Drag the search widget to the sidebar and drop it wherever you want it. You can also click the widget and select the sidebar in the menu displayed. A good place for it is at the top or near the top so people can easily find it.
3 Search your site
The appearance of the search widget depends on the theme and it can be any colour and style but it will look something like this. As you type in, a dropdown list of recent searches is displayed by the browser.
4 View the search results
I searched for ‘gallery’ and a matching result is displayed – a post about creating an image gallery. This is the basic search facility built into WordPress and it is easy to insert into the sidebar and it works reasonably well.
5 WordPress search plugins
Let’s install a superior search facility using a plugin.
- Go to Plugins in the sidebar
- Select Add New
- Enter ‘search‘ into the search box
- Click Install Now next to Relevanssi – A Better Search
- Click Activate after installation
Why Relevanssi? It is one of the most popular search plugins with over 100,000 installations and an excellent rating. Those statistics tell you that this is a good plugin.
6 Index your site with Relevanssi search plugin
Go to Settings in the WordPress sidebar and select Relevanssi. There are multiple tabs with information and settings but to begin with you don’t really need to worry about them because the default settings are fine.
On the Index tab, click Build the index. This creates an index containing all the information in posts and pages on your site. There is an option further down the page to choose whether to index posts or pages or both, and both are selected by default, which is fine.
7 Configure search options with Relevanssi
Relevanssi search uses the existing WordPress search widget and we already put it in the sidebar, so our new super powerful search is ready to use. However, there are some settings you might want to tweak.
Select the Searching tab and there are three main options.
Default operator: If the user types in two or more words, should the search results contain any of the words (the OR option) or only if all the words are present (set this to AND). If someone searches a for ‘apples pears’ you can choose ‘apples OR pears’ or ‘apples AND pears’. The OR option is usually better and produces more results, but AND produces fewer and more accurate results. It’s your choice.
Default order: The search results are displayed in order of relevance by default, but clicking this option enables Date to be selected so that the newest posts are shown first in the results. Which would be best for your site?
Keyword matching: This enables you to choose between returning partial words or complete words. With partial words, if you search for ‘blog’ then posts with ‘blogging’ will be returned, not just posts with ‘blog’ in the title or text.
8 Test the site search
Go to your blog as a visitor and enter search terms into the search box in the sidebar. You should see a difference between the two and the most obvious indications that it is working is when you search for a partial word like ‘imag’ and it returns posts with image, imaging, imagine and so on.
Another difference is that the search term is highlighted in the search results in bold so you can see it in context.
Disabling and enabling the plugin lets you try it both ways. The differences are subtle, but you can see the improvement. There are also many more tweaks in the settings to further improve search results, such as the length of the text snippet that is shown.