Disable Search Feature in WordPress Guide

Disable Search Feature

Would you like to incapacitate the hunt include in WordPress? At times your site may not require the pursuit include and the inquiry frame in your subject may meddle with client encounter. In this article, we will demonstrate to you industry standards to effectively cripple the pursuit include in WordPress.

Why and Who Should Disable Search Feature in WordPress?

Numerous WordPress sites are straightforward business sites with a couple of pages. There is likewise a developing pattern of one-page sites with vertical route.

These sites does not have much substance which influences pursuit to frame a knick knack and not a valuable component.

It additionally gives clients the feeling that there may be some other data that they can’t see and subsequently the pursuit choice. Evacuating seek highlight will tidy up your site and offer a superior client encounter.

That being stated, we should investigate how to effortlessly expel look highlight from your WordPress site.

#1  Expel Search Feature in WordPress Using a Plugin

This strategy is simpler and is prescribed for all clients.

To begin with thing you have to do is introduce and actuate the Disable Search module. For more subtle elements, see our well ordered guide on the most proficient method to introduce a WordPress module.

The module works out of the container, and there are no settings for you to design.

Upon enactment, it will expel look shape from your WordPress topic and incapacitate the hunt gadget. In the event that a client specifically attempted to enter an inquiry question URL, the module will restore a 404 mistake page.

Note that this module does not influence the inquiry usefulness inside the WordPress administrator range. You can even now seek posts and pages inside your WordPress administrator.

 

#2 Physically Disable Search Feature in WordPress

This technique expects you to add code to your WordPress documents. In the event that you haven’t done this some time recently, at that point investigate our guide on the most proficient method to reorder code in WordPress.

[ Further Reading : What’s New on WordPress 4.9 ]

You should add this code to your topic’s functions.php record or a site-particular module.

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 just divert all immediate or circuitous hunt questions to a 404 page. It will likewise conceal the inquiry frame in your WordPress topic.

We trust this article helped you figure out how to effortlessly impair seek highlight in WordPress. You may likewise need to see our uber rundown of the most needed WordPress tips, traps, and hacks.

Leave a Reply

Your email address will not be published. Required fields are marked *