Disable Search in WordPress | Tutorial Freak – Online Tutorials

Disable Search in WordPress

Ever wanted to Disable the Search funtionality on your wordpress site? Let me show you how!

Just use this code and the search will be disabled on your wordpress website:

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;" ) );

Author, Blogger, SEO Expert, Working Professional and a Student! I play so many roles in life and love what i do. I enjoy each moment of my life. Do follow us on Facebook

Sagar – who has written posts on Tutorial Freak – Online Tutorials.


Help keep us alive & kicking, we need coffee 24/7, please donate, thanks!
Embed

Leave a Reply

      
      
      
      
      
      
      
      
             
Save Now! $1.99 .COM at GoDaddy!
             
      
  • How to Configure User Groups in IPB