//searchWP 필터 버튼
function search_sort( $atts ) {
  // return '';
  $active = 'default';
  $url = esc_url( add_query_arg( 's', $_REQUEST['s'], get_site_url() ) );
  if(!is_search()){
    return '';
  }

  if(is_search() && isset($_REQUEST['orderby']) && $_REQUEST['orderby'] == 'date' ){
    return sprintf('<a href="%s"><strong>관련도순</strong></a> | <span><strong>최신순</strong></span>', $url);
  }else{
    $url = esc_url( add_query_arg( 'orderby', 'date', $url ) );
    return sprintf('<span><strong>관련도순</strong></span> | <a href="%s"><strong>최신순</strong></a>', $url);
  }
}
add_shortcode( 'search_sort', 'search_sort' );


//searchWP like 검색을 위한 값 변경 기본값 80 값이 낮을수록 불필요한 검색 노출됨
add_filter( 'searchwp_fuzzy_threshold', function( $threshold ) {
  return 90;
} );

//searchWP like 검색
function search_return_true($boolean){
  return '%';
}
add_filter( 'searchwp_like_wildcard_before', 'search_return_true' );
add_filter( 'searchwp_like_wildcard_after', 'search_return_true' );

 

searchWP 설정 -> advanced -> Partial matches (fuzzy when necessary)  활성화 되어 있어야 함!