{"id":145,"date":"2019-03-08T05:57:46","date_gmt":"2019-03-08T05:57:46","guid":{"rendered":"https:\/\/mumbaiwebhosting.co.in\/portal\/?p=145"},"modified":"2019-03-08T03:10:18","modified_gmt":"2019-03-08T03:10:18","slug":"methods-to-disable-wordpress-search-feature","status":"publish","type":"post","link":"https:\/\/mumbaiwebhosting.co.in\/portal\/methods-to-disable-wordpress-search-feature\/","title":{"rendered":"Methods to Disable WordPress Search Feature"},"content":{"rendered":"\r\n<p>Sometimes our site may not require the search feature and the search form in our theme may interfere user experience in using the website and In this article, we will show you the\u00a0methods to disable search feature in wordpress wesbite .<\/p>\r\n\r\n\r\n\r\n<p>Many WordPress websites are simple business websites with a few pages. Nowadays it is also a growing trend of one-page websites with vertical navigation.<\/p>\r\n\r\n\r\n\r\n<p>These websites does not have much content so it doesn&#8217;t require search feature<\/p>\r\n\r\n\r\n\r\n<p>It also gives users the impression that there might be some other information that they can\u2019t see and hence the search option. Removing search feature will clean up your website and offer a better user experience.<\/p>\r\n\r\n\r\n\r\n<p>Now let&#8217;s see the Methods to disable search feature in wordpress wesbite.<\/p>\r\n\r\n\r\n\r\n<h2>Methods to Disable WordPress Search Feature in the website<\/h2>\r\n\r\n\r\n\r\n<h4>Method 1: Remove Search Feature in WordPress Using a Plugin<\/h4>\r\n\r\n\r\n\r\n<p>First thing you need to do is install and activate the Disable Search plugin. For more details, see our step by step guide on how to install a WordPress plugin.<\/p>\r\n\r\n\r\n\r\n<p>The plugin works out of the box, and there are no settings for you to configure.<\/p>\r\n\r\n\r\n\r\n<p>Upon activation, it will remove search form from your WordPress theme and disable the search widget.<\/p>\r\n\r\n\r\n\r\n<p>Note that this plugin does not affect the search functionality inside the WordPress admin area. You can still search posts and pages inside your WordPress admin.<\/p>\r\n\r\n\r\n\r\n<h4>Method 2. Manually Disable Search Feature in WordPress<\/h4>\r\n\r\n\r\n\r\n<p>You need to add code to your WordPress files to your theme\u2019s functions.php file or a site-specific plugin.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">function wpb_filter_query( $query, $error = true ) {\r\nif ( is_search() ) {\r\n$query-&gt;is_search = false;\r\n$query-&gt;query_vars[s] = false;\r\n$query-&gt;query[s] = false;\r\nif ( $error == true )\r\n$query-&gt;is_404 = true;\r\n}\r\n}\r\nadd_action( 'parse_query', 'wpb_filter_query' );\r\nadd_filter( 'get_search_form', create_function( '$a', \"return null;\" ) );\r\nfunction remove_search_widget() {\r\n    unregister_widget('WP_Widget_Search');\r\n \r\nadd_action( 'widgets_init', 'remove_search_widget' );<\/pre>\r\n\r\n\r\n\r\n<p>This code will simply redirect all direct or indirect search queries to a 404 page. It will also hide the search form in your WordPress theme.<\/p>\r\n\r\n\r\n\r\n<p>I hope this article helps you to understand the\u00a0Methods to Disable Search Feature in WordPress .See you all with another informative post.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Sometimes our site may not require the search feature and the search form in our theme may interfere user experience in using the website and In this article, we will&#8230; <a class=\"read-more-link\" href=\"https:\/\/mumbaiwebhosting.co.in\/portal\/methods-to-disable-wordpress-search-feature\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/posts\/145"}],"collection":[{"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/comments?post=145"}],"version-history":[{"count":2,"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/posts\/145\/revisions"}],"predecessor-version":[{"id":152,"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/posts\/145\/revisions\/152"}],"wp:attachment":[{"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/media?parent=145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/categories?post=145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mumbaiwebhosting.co.in\/portal\/wp-json\/wp\/v2\/tags?post=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}