Skip to content

Instantly share code, notes, and snippets.

@BetoFrega
Created November 5, 2011 03:00
Show Gist options
  • Save BetoFrega/1341031 to your computer and use it in GitHub Desktop.
Save BetoFrega/1341031 to your computer and use it in GitHub Desktop.
Disabling Search on Wordpress
// Disabling Search
function disable_search_query($query, $error = true) {
if (is_search()) {
$query -> is_search = false;
$query -> query_vars[s] = false;
$query -> query[s] = false;
// to error
if ($error == true)
$query -> is_404 = true;
}
}
add_action('parse_query', 'disable_search_query');
add_filter('get_search_form', create_function('$a', "return null;"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment