Qi Theme

Qi Theme – a completely free WordPress theme with 100 modern demo websites

Learn More
Sign up for our newsletter and be the first to get all the latest Qode news and updates.
BACK TO TOP

How to Remove the Search Feature on Your WordPress Website

How to Remove the Search Feature on Your WordPress Website

Over time, people have grown accustomed to looking at a webpage – usually the top right corner – and seeing a search box there. Good website navigation isn’t always easy to achieve, and features such as the search bar can help tremendously.

Does that mean that every website should have a search bar? Of course not. The feature is more than welcome on websites when it’s useful. But if that’s not the case, why not simply remove it altogether?

In this article, we’ll show you:

Qode Themes: Top Picks
Bridge New Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

Why Remove the Search Feature on Your WordPress Website?

There are plenty of different kinds of websites that benefit from having a search bar. It’s common sense that, the more complicated the website and the more content it has, the more valuable the search feature becomes. An online store, for example, would benefit greatly from a search bar. So would a blog or a magazine.

A search feature is an important part of website navigation – as long as there’s somewhere to navigate to. Some websites don’t have more than a page or two. This practice is somewhat common when creating business websites. In those kinds of websites, the search bar won’t be missed too much if it’s gone.

There’s also another kind of problem you might be having with the default search on your WordPress website – it might be too underpowered for your needs. In that case, however, you don’t want to remove the search feature, as it might mess with some of the best search plugins you could use to improve your website. Only remove it when you don’t want to have a search feature on your website – otherwise, try a different search provider such as Google, or try to address your website’s issues in another way, such as excluding specific results from search.

How to Remove the Search Bar from Your Website

Search Bar

The easiest option you can use to deal with the search bar is to either don’t add it in the first place or find its location and remove it. So if you’ve added it to the menu as you can do with our Bridge theme, simply backtrack and have it removed.

The way the WordPress search bar works is through a widget – that’s how you add the bar to your website. If you don’t want your website visitors to see the search box, navigate to Appearance > Widget. Find all the areas where the widget is placed – be it the sidebar, a footer, or a header, and simply remove the search widget.

How to Remove the Search Feature Using a Plugin

Disable Search

If you need to do more than just avoid displaying the search widget, you should try the Disable Search plugin. It’s available from the WordPress.org repository, it has no post-installation options to bother you, and it does a lot more than just prevent the displaying of the widgets.

For example, the search box is available from the admin toolbar even if you’re viewing the website’s front end while you’re logged in.

Search Bar Admin

This plugin will take care of that. It will also completely disable the search widget – it won’t even appear in the list of available widgets. It won’t be deleted, either, so you can bring it back at any time by uninstalling the plugin, as the only thing it does is hide it.

The plugin will also not cause any issues with searching in the backend. It won’t interfere with the search engine’s abilities to search your website. It will prevent any GET or POST requests from returning search results.

How to Remove the Search Feature Using Code

In case you’re feeling particularly adventurous, you can add your code to functions.php and disable the search function that way. And even if you’re not into tinkering with functions.php, there are still great, easy ways to add custom code to WordPress. So why don’t you grab the Code Snippets plugin and install and activate it?

Code Snippets

After activating the plugin, add the following lines of code as a snippet:

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', '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' );

This will ensure that the widget is removed from the website and the list and that any existing query returns a 404 error as a result.

Let’s Wrap It Up!

When creating a website, it’s important to avoid overstuffing it with unneeded features. Not only will they confuse the visitor, but they might also make the website slower to load, or present potential security risks.

For a website that has a page or two and generally aims to provide all the information to the visitor from one place, there’s little use for a search bar. No matter how useful the feature is for some types of websites, when there’s no clear reason to use it, you’d best remove it. You’ve got a couple of different ways of doing it, but none should require too much time or effort.

Post your comment

Comments0