searchwp\tokens
4.0.0以降
インデックス作成時と検索時の両方でトークンを操作します。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 |
|---|---|---|---|
| String[] | $tokens |
ルール適用後のトークン | 4.0.0 |
例
All hooks should be added to your custom SearchWP Customizations Plugin.
トークンから会社名を削除
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 | |
| // Remove company name "ACME" from tokens in SearchWP. | |
| add_filter( 'searchwp\tokens', function( $tokens ) { | |
| return array_filter( $tokens, function( $token ) { | |
| return 'ACME' !== $token; | |
| } ); | |
| } ); |

