AWPGuide

Beginner's Guide For WordPress

  • Blog
    • Monetization
    • Reviews
    • Showcase
    • WordPress Guides
    • ScanWP
  • Start Here
  • Deals
  • Blueprint

Last Updated On March 5, 2019 By Christina

AWPGuide » WordPress Guides » How To Disable The Search Feature In WordPress

How To Disable The Search Feature In WordPress

How To Disable The Search Feature In WordPress

Do you want to disable the search feature in WordPress blog? There’s a simple way to do it. Most folks will choose WordPress for creating their blog or website. but the fact is nobody knows the WordPress search feature can be disabled! Well, we are going to show you a step by step guide for disabling the search feature in WordPress.

Table Of Contents

  • Why Do You Need To Disable Search Feature?
  • How To Disable The Search Feature In WordPress
  • Disable Search Using Plugin
  • Disable Search Using Code

Why Do You Need To Disable Search Feature?

As I said, most website owners are using WordPress for creating their websites. This can be one-page WordPress websites or business websites. You know these type websites do not need any search feature there. In that case, the feature must be in disabled format.

How To Disable The Search Feature In WordPress

At this time, there are 2 methods.

  • Plugin Method – Which is very simple.
  • Coding Method – Just need to add some codes to the theme’s functions file.

if you are a guy who changes theme recently, we recommend you going with the plugin method. If you are stick with any WordPress theme and receives updates only, we recommend you to create a child theme and add the code in the functions file.

We are going to show you both methods below.

Disable Search Using Plugin

First of all, go to your WordPress dashboard and add new plugins section. There, you need to search for the Disable Search plugin. Simply install it to your blog.

Disable The Search Feature In WordPress

Now, activate it.

activate the disable search plugin on wordpress

You are done! The plugin doesn’t need any additional configuration. Simply activate it on your blog to disable the search feature. All the added search widget will disappear from your blog.

Disable Search Using Code

Don’t want to use more plugins? Well here’s the code to disable the feature. Copy the below code, paste it on your child theme’s functions file and update the file.

 function fb_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', 'fb_filter_query' );
add_filter( 'get_search_form', create_function( '$a', "return null;" ) ); 

search feature disabling code

All added search widgets will be removed after adding this code.

NOTE: In some cases, the code will conflict with other theme functions and specific plugins. If you are experiencing any issues with the code, we recommend you choose the plugin method. It will work with most WordPress themes without getting any error.

This is how you can disable the search feature in WordPress. We hope you enjoyed the read and found it useful. If you did, please consider sharing this post with your friends and fellow bloggers on social media.

For more related posts, you may want to check out our blog section.

Full Disclosure This post may contain affiliate links, meaning that if you click on one of the links and purchase an item, we may receive a commission (at no additional cost to you). All opinions are our own and we do not accept payments for positive reviews.
Avatar

About Christina

Christina is the lead editor in AWPGuide.
She will mainly write about WordPress tutorials, product reviews, monetization tricks, and related stuff.
Christina is led by Sreehari.

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let us have a personal and meaningful conversation.

Learn WordPress Now!

Never miss our updates! We are adding fresh contents daily!
Join our newsletter and learn WordPress now!

The Best of AWPGuide

We have the best guides here! Some of them are below!

Beginner's Guides

  • 1
    Media.net Review (and RPM Optimization Guide)
  • 2
    Grammarly Review: Free Proofreading Tool
  • 3
    Why You Need To Build an Email List?
  • 4
    How To Start a Free Blog on CloudAccess.net
  • 5
    Aspire pro Documentation and Setup
  • 6
    WP Engine Affiliate Program Review
  • 7
    How To Add Coupon Section In WordPress

Theme Reviews

  • 1
    Jupiter X WordPress Theme Review
  • 2
    Newsmag WordPress Theme Review
60% DISCOUNT
AWPGuide60
Hostgator Coupon

HostGator Coupon

Do you want a charming 60% discount on HostGator hosting? Well, we got you covered. For AWPGuide users, HostGator is offering something huge!
Get This Deal

ABOUT AWPGUIDE

Finally we have launched AWPGuide blog! At this time of writing, we know, there are so many blogs are providing blogging and money making tips and tricks.

We are not like them! In AWPGuide, we will cover WordPress, blogging, SEO, make money online guides and will teach you how to start, maintain and monetize a WordPress blog.

All these guides will be 100% free and always it will be. We are not running a typical membership website for making money. Also, AWPGuide is free from display advertising, pop-up ads and URL shortner!

For more, feel free to check out our about page.

SITE LINKS

About Us

Advertise Here!

Contact Us

Free Blog Setup

Terms of Service

Write For Us!

Privacy Policy

Deals

OptinMonster Coupon

MyThemeShop Coupon

WPForms Coupon

Bluehost Coupon

CSS Hero Coupon

Social Warfare Coupon

REVIEWS

Genesis Framework

WP Coupons

WP Review Pro

Slider Revolution

Newsmag

Jupiter X

MonsterInsights

© 2021 · AWPGuide LLC