Disable WordPress Search

If you want to disable the WordPress search:

function snippet_filter_query( $query, $error = true ) {
  if ( !is_admin() )
    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', 'snippet_filter_query' );
add_filter( 'get_search_form', create_function( '$a', "return null;" ) );

If you set $error to true, a 404 error is being shown when somebody uses the WordPress search.