解决了的话,那我补充个直接完全禁用 WordPress 搜索功能的
/*
//禁用 WordPress 全局搜索功能
//https://bbs.weixiaoduo.com/topic/37960
*/
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;" ) );