Search feature in websites are really helpful for users to find and search for certain items in a website. WordPress comes with a default search feature. Although WordPress default search feature is not as bad as it was, it is still far from perfect. Searching in WordPress powered search does not always give you relevant results. This article shows steps to remove search feature from WordPress completely.
Reasons to disable default WordPress search feature:
- Search result shows unrelated links in the site search feature
- For using third party site search site like Google Custom Search etc.
- Default search is less likely to give visitors what they search for. This may scare them off.
- If you have less amount of content in your website, search result may not be necessary.
- Sticking with default search denies you search analytic.
- If your competitors have better search on their sites, you can be left behind.
Steps to Remove Search Feature from WordPress Completely
You need to add a few lines of codes in the functions.php file to disable search feature completely from website. If you are wondering where to find functions.php file, follow these steps.
1. Login to your WordPress Dashboard.
2. Go to Appearance > Editor.
3. The sidebar in the right has template files. Search for Theme Functions(functions.php) and select it.
4. Copy and paste the following code in the functions.php file inside the php tag.
function filter_query( $query, $error = true ) { if ( is_search() ) { $query->is_search = false; $query->query_vars[s] = false; $query->query[s] = false; // to error if ( $error == true ) $query->is_404 = true; } } add_action( 'parse_query', 'filter_query' ); add_filter( 'get_search_form', create_function( '$a', "return null;" ) );
5. Finally click the Update File button at the bottom to save it.
This code will remove the search function. In the above code if you set $error to be true, then the users will be directed to 404 page. If you set $error to be false, then the users stay at the same page where they tried to run the search.
Remove Search Feature from WordPress using Plugin
If you don’t like above procedure, you can also use plugins like Disable search to perform the same task.
Step 1. Install and activate Disable Search
Go to Dashboard > Plugins > Add New and search for Disable Search in the search box.
Step 2. Activate Plugin
Once you activate the plugin from Installed plugin list it should automatically disable search feature from your website. If you want to bring back the old default search field you can always delete the added code from the function.php file or disable the plugin.
Related Posts

Kantiman Bajracharya

Latest posts by Kantiman Bajracharya (see all)
- What are Different WordPress Theme Licensing Terms? - December 21, 2017
- 4 Tips to Optimize Your WordPress for Social Media Share - November 30, 2017
- What is WordPress? Is WordPress Free? Why is WordPress so popular? - November 22, 2017