| WordPress

WordPress has its own built-in search facility. This works fairly well, but it doesn’t let you make any changes to its standard settings.

If you want a search facility that searches only specific sections of your website or if you want to exclude some pages from the search you will need a plugin.


Option #1: The Search and Filter plugin

The Search & Filter plugin lets you refine your search results or remove the search box entirely and replace it with a filtering system. Filtering can be particularly useful if your site uses a specialized vocabulary that users may be unfamiliar with, or likely to spell incorrectly.

You can refine searches by the following features:

  • Category
  • Tag
  • Custom taxonomy
  • Post type
  • Post date.

Or you can define a combination of any of the above.

To add a search box to any page or widget you can use a shortcode like this:

[searchandfilter fields="search,category,post_tag"]

You can customize this shortcode to add a search box to a page that will only search blog posts or pages on a particular subject. So, for instance, you can limit the search results to content that is in a specific category or has a particular tag. You can also confine search results by date so that your results do not go back too far in time.

  • To install go to Plugins > Add New.

Two Easy Ways to Improve the WordPress Search Results

  • Install and activate.

You will now find the Search & Filter option on the dashboard’s left-hand column.

This page just explains the various syntax for the shortcode that you will insert into a page or widget.

For instance, if you want to search only posts that are in the category ‘movie’ then you would insert a shortcode like this:

[searchandfilter fields="search,movie"]

Or you can add a search box that only searches blog posts and lets users select the category of their choice.

This way, users don’t have to wade through pages of search results to find what they are looking for.

If instead, you wanted to add a filtering system, you would use a shortcode like this:

[searchandfilter fields="category,post_tag" submit_label="Filter" headings="Categories,Tags"]

And the filter would look like this:


Option #2: The Search Exclude plugin

If you want to exclude certain pages from your search facility then install the "Search Exclude" plugin.

Once you have installed and activated the plugin, you will find a new option on every page.

On the document’s right-hand sidebar you will see a checkbox that lets you exclude that page/post from the search results.

Under Settings, you will also find the Search Exclude option that lists all content that has been excluded from the search. Here you can also remove the exclusion from some pages if you decide you want to include them in the search results again.


Conclusion

By adding these plugin’s WordPress’s normal search results can be greatly enhanced and you can help your visitors to find what they want more easily.


About the author

Born in Zambia but living now in Cape Town, South Africa, Libby Young started out as a journalist. She taught herself HTML when the company where she was an sub-editor made the transition from CD-Rom to the web 20 years ago. Since then she has developed content-rich websites using a variety of open source content management systems.