When using WordPress as a CMS, sometimes the search feature becomes unnecessary. You can remove the search bar from the design, but the functionality still remains. You can add the following function and disable the search function:
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;” ) );
Disable Search in WordPress
No comments:
Post a Comment
Please mention your comments.......