wordpress snippets last updated   : April 14, 2014
we now have 630 snippets

Disable wordpress search

wordpress snippet

Adding this code to your functions.php within your wordpress theme will disable search.

snippet :  PHPcopy
function fb_filter_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', 'fb_filter_query' );
add_filter( 'get_search_form', create_function( '$a', "return null;" ) );
source →
jqsnipp.com | we just launched jquery snippets website