Search
Close this search box.

How to Disable WordPress Search Feature?

Affiliate disclosure: In full transparency – some of the links on our website are affiliate links, if you use them to make a purchase we will earn a commission at no additional cost for you (none whatsoever!).

Do you want to turn off the WordPress search function? Your site may not need a search feature all the time, and the search form in your theme may get in the way of how users use your site. In this article, we’ll show you how easy it is to turn off WordPress’s search function.

The search feature in WordPress is very helpful, but you might want to get rid of the default search feature at some point.

Why Should I Turn Off the Search Function in WordPress?

disable wordpress search feature

Many WordPress sites are straightforward business sites with only a few pages. There is also a growing trend of websites with only one page and navigation on the side.

Since these sites don’t have much content, the search form is more of a novelty than a useful tool.

It also makes people think that there might be more information they can’t see, which is why the search option is there. Getting rid of the search feature will make your website look better and make it easier for people to use.

So, let’s look at how easy it is to get rid of the search feature from your WordPress site.

How to disable WordPress Search with a Plugin?

We’ll use the well-known disable WordPress search plugin, which you can get for free from the WordPress repository.

Follow these steps to turn off the search feature in WordPress with a popular plugin called “Disable Search.”

  • Go to Plugins > Add New in your WordPress dashboard and search for the “Disable Search” plugin.
  • Get the Disable Search plugin from the WordPress plugin repository and turn it on.
  • Once the plugin is turned on, it should turn off your WordPress blog’s built-in front-end search.

It’s important to know that the plugin only stops search from working on the front end of your WordPress site. If you still see search boxes, it could be because you are using a different theme.

This plugin, on the other hand, will make sure that those search boxes don’t work.

Here is how to do step by step:

Step 1: Use a WordPress plugin 

You might want to disable the platform’s search function if you’re using WordPress to power a simple site, such as a single landing page for your company, brand, or organisation. Use the Disable Search plugin to accomplish this.

This plugin disables the search sidebar widget and prevents the search form from appearing in the majority of WordPress themes. Keep in mind that the plugin only disables search on your site’s front end. The WordPress admin dashboard’s back-end search functions are unaffected.

Step 2: Disable using code  

You have to add code to your WordPress files for this method. If you’ve never done this before, check out our guide to copying and pasting code in WordPress.

You will need to add this code to the functions.php file of your theme or a plugin made just for your site.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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' );

All direct or indirect search queries will be sent to a 404 page by this code. It will also make your WordPress theme hide the search form.

Conclusion

We hope this article showed you how easy it is to turn off WordPress’s search feature. Have you turned off your blog’s search function? Tell me in the comments section below.

Jitendra

Jitendra Vaswani is the founder of SchemaNinja WordPress Plugin, prior to SchemaNinja he is the founder of many internet marketing blogs BloggersIdeas.com, and Digiexe.com. He is a successful online marketer & award-winning digital marketing consultant. He has been featured on HuffingtonPost, BusinessWorld, YourStory, Payoneer, Lifehacker & other leading publications as a successful blogger & digital marketer. Jitendra Vaswani is also a frequent speaker & having 8+ yrs experience of in the Digital Marketing field. Check out his portfolio( jitendra.co). Find him on Twitter, & Facebook.

Leave a Comment

0 Shares
Tweet
Share
Share
Pin