searchwp\source\post\attributes\taxonomy\terms
4.0.0以降
インデックス作成前に投稿のタクソノミ用語を操作します。タクソノミーがエンジンに含まれている場合にのみ適用されます。
関連項目 searchwp\source\post\attributes\taxonomy\term 個々の用語をフィルタリングします。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WP_Term[] | $terms |
タクソノミ用語オブジェクト | 4.0.0 |
||||||||||||
| 配列 |
$args
|
4.0.0 |
|||||||||||||
例
すべてのフックはカスタムのSearchWP カスタマイズプラグインに追加する必要があります。
特定のカテゴリを投稿と一緒にインデックスしないようにする
インデックス作成時に未分類カテゴリ用語をインデックスしないようにします。
| <?php | |
| // Prevent specific Category from being indexed with posts in SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\taxonomy\terms', function( $terms, $args ) { | |
| // Do not index the 'Uncategorized' term. | |
| return array_filter( $terms, function( $term ) { | |
| return 'Uncategorized' !== $term->name; | |
| } ); | |
| }, 20, 2 ); |

