How to Disable the Search Feature in your WordPress Website?

Do you want to learn to disable the search feature on your WordPress website?
The search feature is useful as it allows users on your site to search for a specific piece of information with ease. 
But, for a simple business website or a growing one-page website that has limited content, the search feature is of no use. In such cases, removing the search option makes it clear for the audience that there is no other information to show. 


Disable the Search Feature in WordPress

Method 1: Remove/Disable the Search Feature using Plugin

Install and Activate the Disable Search Plugin

Method 2: Manually Disable Search Feature using Code


Wrapping Up

Disable the Search Feature in WordPress
In this tutorial, we will learn to disable the search feature on a WordPress site. There are various ways to disable the feature in WordPress. In this tutorial, I have mentioned two different ways. Let’s Start:
Method 1: Remove/Disable the Search Feature using Plugin
In WordPress, there are thousands of plugin to limit the default function of the site. Here too, we can use a plugin to do so. Disable Search is one of the best plugins that allows you to remove this feature.
Install and Activate the Disable Search Plugin 
As a first step, you need to have the Disable Search Plugin on your site. It’s a free WordPress plugin. Follow our tutorial guide on ‘How to Install a New WordPress Plugin?’ Activate the plugin after you install it. 

Upon the activation of the plugin, the search feature will automatically be disabled from your site. No extra steps! It removes the search form on the site and disables the search widget. 
Method 2: Manually Disable Search Feature using Code 
The next method is by using a code. It’s simple. All you need to do is copy and paste the below-mentioned code in your theme’s function.php file. It is better to make use of the child theme as it gets easier to add code and doesn’t affect your site even if it’s placed wrong. 

function wpb_filter_query( $query, $error = true ) {
if ( is_search() ) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
if ( $error == true )
$query->is_404 = true;
add_action( ‘parse_query’, ‘wpb_filter_query’ );
add_filter( ‘get_search_form’, create_function( ‘$a’, “return null;” ) );
function remove_search_widget() {
add_action( ‘widgets_init’, ‘remove_search_widget’ );

Wrapping Up
This is the end of the article. I hope this was helpful to remove/disable the search feature on your site. Also, follow our tutorials to learn more about WordPress!
Also, Check-Out:
How to Create AMP Form in your WordPress Website?



Leave a Comment

Your email address will not be published.

Table of Contents

On Key

Related Posts

Best Google Maps Plugins for WordPress

Before we start looking at any plugins, it’s good to review the way Google Maps work. There are several components in the Google Maps API family, all of which can be found on the Google Maps API Family page. When working with WordPress, we are mainly interested in two of these APIs: Static Maps APIMaps

How to Get a Custom Field Value via Shortcode

Sometimes we want to make it easy for site administrators to include the value of a custom field (maybe created as part of a custom meta box) into a post. An ideal solution to this challenge is to use shortcodes. You can either do this through these two plugins: Get Custom Field Values Custom Fields

Best Auto Translation Plugins for WordPress

Having the content of your website available in different languages can mean a much bigger audience for you. A very simple way to do this is to provide automatic translators, they’re not the same as manually translating all your content, but do a pretty good job. It’s better to have an automatic translation plugin than

Best WordPress Multilanguage Plugins

The two main contenders as best multilanguage plugins for WordPress are WPML and QTranslate. If you want a quick answer to which one comes out on top, I would say go for WPML. If you have enough time to give them a test drive, by all means, do so and judge for yourself which one