1/5 - (1 vote)

Do you want to remove the search feature in WordPress? The search option is an extremely useful tool for assisting your visitors in finding exactly what they are looking for. In this article, we will demonstrate how to disable the search option in WordPress in the easiest way. Let’s explore!

Why Should Disable Search Feature in WordPress?

Many WordPress websites are simply one-page business websites. The lack of material on many websites makes the search form a novelty item rather than a helpful feature. It also gives people the sense that there is more information that they aren’t seeing, which is why the search option is available. Removing the search function would make your website look cleaner and provide a better user experience. As a result, let’s have a look at how to remove the search tool from your WordPress site with ease.

How to Disable the Search Feature in WordPress?

Today, I will show you how to disable the search tool in WordPress using two different techniques. The first approach will be using the Disable Search plugin to remove the search feature. The second way is to disable the search feature directly by modifying the functions.php file in your theme. Keep in mind that if you choose the second way, you must have access to your web host’s cPanel login details. Now, you can follow 2 methods through the steps below:

Method 1: Remove Search Feature in WordPress Using a Plugin

The first thing you have to visit is the Plugins » Add New page inside your WordPress admin area.

Disable The Search Feature In Wordpress

In the available search box, type “Disable Search.” This will bring up a list of additional plugins that you might find useful.

Disable The Search Feature In Wordpress

Scroll down until you locate the Disable Search plugin, then click the “Install Now” option to install and activate it.

Disable The Search Feature In Wordpress

Upon activation, it will remove the search form from your WordPress theme and disable the search widget. If a user directly tried to enter a search query URL, the plugin will return a 404 error page.

Disable The Search Feature In Wordpress 5

Unlike other plugins, Disable Search plugin operates immediately after activation. One of the biggest benefits is that you don’t need to configure any plugin’s settings to use this tool. Take a peek at your website and you will discover that the search function is no longer available. Keep in mind that this will not disable the search feature in WordPress’s admin area, but that is solely for the admin view.

Method 2. Manually Disable Search Feature in WordPress

This solution necessitates the inclusion of code in your WordPress files. Furthermore, you also need to add this code to your theme’s functions.php file or a site-specific plugin.

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() {
unregister_widget(‘WP_Widget_Search’);
}
add_action( ‘widgets_init’, ‘remove_search_widget’ );

As a result, all direct and indirect search inquiries will be sent to a 404 page with this code. It will also make your WordPress theme’s search form invisible.

Conclusion

We have just shown you how to effectively disable the search feature in WordPress. Hopefully, you will find this information to be beneficial to your website. If you have any questions or require assistance, please contact us. We will reply as soon as possible.

You may also use our Free WordPress Themes to go through a variety of outstanding, SEO-friendly themes and templates. Thanks for your reading.

1

We’re Digital Content Marketing team from AgeThemes Marketplace. We provide quality content for everyone who using open source CMS like Joomla and WordPress. If you have any questions or feedback, feel free leave your comment, we happy to assist you asap.

Leave a Reply

Your email address will not be published. Required fields are marked *

Summer Sale Enjoy your purchase with 50% OFF on today! code: SUMMER2024 More Details
Summer Sale Enjoy your purchase with 50% OFF on today! code: SUMMER2024 More Details