Search feature comes by default in WordPress. WordPress provides a search widget for this. And also WordPress defined a page template and a form for this. Which you can customise as per your requirement. But what if you want to disable WordPress search feature?

Sometimes your site not has need for search functionality. Or you don’t want the search for better user experience. In this post, we learn to disable the WordPress search system.

Why disable WordPress search Feature?

Assume you are using a WordPress site which has a login system. Means some of the pages will be visible to only logged-in users. If such website enabled search feature, then there will a chance to find these login page in search results.

In above case, your site does not need to have the search feature. So you can disable search feature on WordPress website.

How to disable WordPress Search feature?

Now you get who should disable search feature. Now how can one disable WordPress search feature? It’s very simple to do that. So let dig into this.

Disable WordPress Search feature via Plugin

I love WordPress because of plugins. You can get any type of plugins for free. Similarly, there are a plenty of plugins available on WordPress Plugin repository to disable search feature.

disable search free WordPress plugin

Source: Plugin Page

Disable Search is one of the free plugins that help you to disable search feature form your WordPress site. Once you install and activate the plugin. You site no more have the search feature. This plugin not required any additional setting.

Once you activate Disable Search plugin, search widget from widget library will remove. If you directly add search query URL, then the site will show an error page(404 page).

Disable WordPress search feature via Child Theme

If you are using WordPress for a while, you should know about the child theme. Using child theme for customization is the best way to not lost changes on theme update. It needs some code customisation, so you can say it Manual method to Disable Search Feature in WordPress.

For this, create a child theme for your active theme. Add below code in child theme’s functions.php file.

This function will generate 404 error when a search query in rendered. While unregister_widget is used to disable the search widget.

Conclusion:

This is how you can remove search feature from your WordPress site. Removing search feature is good for those, who use a business website with a low number of pages. Hope you like this tutorial. If you have any query related to WordPress search feature, comment it.