Call Us Toll Free - US & Canada : 888-818-9916 UK : 800-069-8778 AU : 1800-990-217

How To Remove Search Bar From WordPress

Spread the love

Last updated on December 26th, 2019 at 07:44 am

With every website, there come a plenty of tools, features, and options that aim at streamlining the user experience. Of these, a search bar at the top or anywhere across the site is a must. It gives users the ease to simply enter their search query and get the results quickly without having the need to specifically browse the website.

Often, a search bar is an important part of a website and WordPress developers make it a need to embed one within the website. However, there are times when a search bar seems obscure and having it within the developed WordPress website is not required.

In such a case, what you can do is customize the appearance of the website and modify it to function without a search bar.

While this might be important to you but the fact that you don’t need a search bar seems intriguing. Hence, before outlining how we would shed some light on why?

Why on earth your website would not need a search bar or for which of the businesses, a search bar stands irrelevant?

Why Do You Not Need A Search Bar?

We might have heard that a search bar filters the result, offering users exactly what they want and in the least possible time, right? But at times, it might so happen that users fail to attain the desired outcome, irrespective of the fact whether or not, your website delivers the thing searched for. This agitates the customer which might even leave the website without browsing much.

Here, the presence of the search bar apparently shattered the user’s expectation and odds are, you just lost a potential customer.

Another important reason why the removal of a search bar interests you much is that you have a simple business website. Or, it could be that the website is of a single page without much to offer. In such a case, a search bar would obviously lead the user to nowhere. And so, removing it would be the best thing you can do.

If under any circumstances, you wish to retain the search bar, it might give an impression to the user, that your website has something else to offer. They might enter a query only to get disappointed. So, why showcase something that does not render anything? It’s better to straightforward remove the search bar from the website offering your users a better browsing experience.

How to Remove WordPress Search Bar?

Acknowledging the fact that you are convinced of the removal of search bar from the site or are aware of the instances where you don’t need one, let’s see how you can achieve the above.

By Manually Removing - Through Admin Dashboard

One of the easiest and the most convenient way to remove a search bar from the WordPress website is by modifying the settings.

  • Login to the WordPress dashboard using the credentials.
WordPress admin
  • Move around to find the Appearance tab.
  • Click on it and go to Customize
wordpress widget
  • Click on the desirable widget and then select the area.
  • Next, click on the search bar or the search option as displayed in the widget set and click on remove.
wp widget
  • Click on the update to save the changes made.

With this, you have now removed the search bar from the WordPress website.

Through function.php file

In case you don’t have the access to the admin dashboard or due to some reasons, you are unable to login, you can still remove the search bar by accessing the function.php file.

  • Log in to the site using FTP
  • Visit the WordPress directory and click open wp-content/themes/your-theme-folder
  • Right on the file that needs to be edited.
  • Select View/Edit file to modify the same.
  • Once opened, copy the following:

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’ );

After the addition of the code, the search bar is hidden from the WordPress theme and even if a search query is fed, the user is directed to 404-page error.

Final Word

It seems easy, right? The only thing that you need to make sure is whether or not, you need a search bar. Based on the answer, you can either keep it or remove it using the steps mentioned above.


Join the discussionSHARE YOUR THOUGHTS

Top 7 WooCommerce SEO Plugins for 2023 to Boost Your Google Ranking