Disabling search queries in WordPress is not a common practice, as the search functionality is very useful for many websites. However, if you need to disable search queries for a specific reason, you can do so by adding the following code to your theme's functions.php file:
function themesdna_disable_search_queries( $query, $error = true ) {
if ( is_search() && ! is_admin() ) {
$query->is_search = false;
$query->query_vars['s'] = false;
$query->query['s'] = false;
if ( true === $error ) {
$query->is_404 = true;
}
}
}
add_action( 'parse_query', 'themesdna_disable_search_queries', 15, 2 );