Welcome to 360votes Q&A, where you can ask questions and receive answers from other members of the community.
Buy Reseller Club Hosting The hassle-free way to register your domains Wordpress Hosting Get a 15 Day Free Trial at

How to Disable the Search Feature in WordPress

+1 vote
How to Disable the Search Feature in WordPress
asked Oct 12 in Computers & Internet by haripcexpert (3,330 points)

1 Answer

0 votes

Method 1. Remove Search Feature in WordPress Using a Plugin

This method is easier and is recommended for all users.

First thing you need to do is install and activate the Disable Search plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin works out of the box, and there are no settings for you to configure.

Upon activation, it will remove 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.

Method 2. Manually Disable Search Feature in WordPress

This method requires you to add code to your WordPress files. If you haven’t done this before, then take a look at our guide on how to copy and paste code in WordPress.

You will 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() {


add_action( 'widgets_init', 'remove_search_widget' );

This code will simply redirect all direct or indirect search queries to a 404 page. It will also hide the search form in your WordPress theme.

answered Oct 12 by admin (5,110 points)