searchwp\query\partial_matches\tokens
4.0.0以降
部分一致ロジック適用中に部分一致トークンを操作します。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| String[] | $partial_tokens |
SearchWPによって見つかった部分一致トークン | 4.0.0 |
||||||||||||
| 配列 |
$args
|
4.0.0 |
|||||||||||||
例
All hooks should be added to your custom SearchWP Customizations Plugin.
たとえそうでなくても、常に「coffee」を部分一致に追加する
「coffee」という単語を常に部分一致のリストに追加したい場合:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Always add 'coffee' to partial matches even if it's not. | |
| add_filter( 'searchwp\query\partial_matches\tokens', function( $partial_match_tokens, $args ) { | |
| $partial_match_tokens[] = 'coffee'; | |
| return $partial_match_tokens; | |
| }, 10, 2 ); |

