Welcome
We've been working hard

How to disable the search function in WordPress

Disable the search function in WordPress, pure code without plug-ins; Copy and paste the following code into the function.php file.

 function wdp_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', 'wdp_filter_query' ); add_filter( 'get_search_form', create_function( '$a', "return null;" ) );

 

Like( zero ) Reward
Do not reprint without permission: New Start Blog » How to disable the search function in WordPress


Follow the public account "New Start Software Steward"

Get the latest network resources and cracking software!
Play with all kinds of software

comment Grab the sofa

You must log in before commenting!

 

Reward the author of the article if you think it is useful

Thank you very much for your reward, we will continue to give more high-quality content, let's create a better online world together!

Scan Alipay and reward

Scan WeChat and reward