Thursday, November 26, 2020
Home Blogging How to Disable the Search Feature in WordPress

How to Disable the Search Feature in WordPress

Do you wish to disable the search feature in WordPress? Generally your website might not want the search feature and the search type in your theme might intrude with person expertise. On this article, we are going to present you learn how to simply disable the search feature in WordPress.

Why and Who Ought to Disable Search Feature in WordPress?

Many WordPress web sites are easy enterprise web sites with a couple of pages. There may be additionally a rising pattern of one-page web sites with vertical navigation.

These web sites doesn’t have a lot content material which makes search type a novelty merchandise and never a helpful characteristic.

It additionally offers customers the impression that there may be another info that they’ll’t see and therefore the search possibility. Eradicating search feature will clear up your web site and supply a greater person expertise.

That being mentioned, let’s check out learn how to simply take away search feature out of your WordPress website.

Methodology 1. Take away Search Feature in WordPress Utilizing a Plugin

This methodology is simpler and is really useful for all customers.

Very first thing you must do is set up and activate the Disable Search plugin. For extra particulars, see our step-by-step information on learn how to set up a WordPress plugin.

The plugin works out of the field, and there aren’t any settings so that you can configure.

Upon activation, it would take away search type out of your WordPress theme and disable the search widget. If a person instantly tried to enter a search question URL, the plugin will return a 404 error web page.

Observe that this plugin doesn’t have an effect on the search performance contained in the WordPress admin space. You possibly can nonetheless search posts and pages inside your WordPress admin.

Methodology 2. Manually Disable Search Feature in WordPress

This methodology requires you so as to add code to your WordPress recordsdata. If you happen to haven’t executed this earlier than, then check out our information on learn how to copy and paste code in WordPress.

You’ll need so as to add this code to your theme’s features.php file or a site-specific plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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() {
    unregister_widget('WP_Widget_Search');
}
add_action( 'widgets_init', 'remove_search_widget' );

This code will merely redirect all direct or oblique search queries to a 404 web page. It is going to additionally cover the search type in your WordPress theme.

You May Also Like : How to Properly Disable Google AMP in WordPress

We hope this text helped you discover ways to simply disable search feature in WordPress. You may additionally wish to see our mega listing of the most needed WordPress ideas, tips, and hacks.

If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

70 Latest Part Time Jobs & Online Jobs from Home (Earn Rs 40,000 Per Month)

Part time jobs are an effective way to make some additional earnings from house. There are numerous half time offline jobs in addition to...

Average Merchant Navy Salary & Their Duties (By Dept & Rank)

Working in Merchant Navy may be very profitable career in India. Usually, former personnel of the Indian Navy choose to work with Merchant Navy...

25 Most Important Extra Curricular Activities for Student’s Development

In earlier days, extra curricular activities had been the one supply of leisure. Hi-tech devices equivalent to fancy LED televisions, smart-phones, laptops and computer systems...

How to Delete Naukri Profile Permanently

If you might be searching for a job and questioning which is the very best place to discover one then Naukri.com could be the...

Recent Comments