Do you want to disable the search function on your WordPress site? The search option is a very useful tool for assisting your visitors in finding precisely what they are looking for. The search tool does not operate properly with all themes. In fact, it may interfere with your present theme and make your website appear worse.
Many benefits are linked with the search tool, which is why many websites are fast to implement one. Unfortunately, many of these websites are new and do not yet have enough material to reap the rewards. Today, I’ll show you how to deactivate the search tool in WordPress using two different techniques.
Why Remove the Search Feature in WordPress?
The search function is ideal for websites with a large amount of material saved in their archives. When new material is introduced, it becomes progressively difficult to discover earlier content. The search choice permits you to scan the entire site for specific keywords, things, or content titles. This is mainly treasured for larger web sites which have been on line for an entire year. Unfortunately, this functionality may conflict with your current theme, resulting in an unappealing website.
You can watch the video tutorial below for this article:
Furthermore, many company owners may build a basic website to showcase their specials, location, and hours. These are excellent examples of websites that do not require a search tool. There is not anything for travelers to appearance for! This is the question you should ask yourself before implementing the functionality.
Of course, it’s possible that the functionality isn’t present because you didn’t add it. Many premium themes provide extra features to make you feel like you’re getting your money’s worth. Since a choice is accessible doesn’t suggest that you should use it.
How to Disable the Search Feature in WordPress?
Today, I’ll show you how to deactivate the search tool in WordPress using two different techniques.
- First, flow in your WordPress Admin Dashboard.
- Hover your mouse over Appearance.
- Then, select Theme Editor.
- Now, on the right side, choose Theme Functions.
- Scroll right all the way down to the bottom of the page.
- You must add a short bit of code here.
NOTE: Before making any code-associated changes, it’s far counseled to have a backup of your internet site JUST IN CASE some thing is going wrong, then you could at least repair it afterwards.
Code:
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’ );
- Once you’ve added it, just tap on the Update File.
Now, you’ll see that the file has been updated successfully. You can go check your website to confirm if the search feature has been removed from your site.
You should have been able to disable the search feature in WordPress as long as you followed our instructions correctly.
Please visit our website or contact Digital Suncity if you have any more queries or require assistance.
Also Read: How To Properly Disable Google AMP In WordPress
0 Comments