How to disable search function
How can I remove search function (website.com/?s=) in WordPress?
Add this script to you functions file:
<?php /** * Redirect Search to home page **/ add_action('template_redirect','wpster_search_redirect'); function wpster_search_redirect() { global $wp_rewrite; if(is_search()&&isset($_GET['s'])) { $s = sanitize_text_field($_GET['s']); $location = '/'; $location = home_url($location); wp_safe_redirect($location,301); exit; } } ?>