searchwp\source\post\attributes\taxonomy\terms
Depuis : 4.0.0
Table des matières
Manipuler les termes de taxonomie d'un article avant l'indexation. Ne s'applique que lorsque la taxonomie a été incluse dans un moteur.
Voir aussi searchwp\source\post\attributes\taxonomy\term pour filtrer les termes individuels.
Paramètres
| Type | Paramètre | Défaut | Depuis | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WP_Term[] | $terms |
Objets de terme de taxonomie | 4.0.0 |
||||||||||||
| Tableau |
$args
|
4.0.0 |
|||||||||||||
Exemples
All hooks should be added to your custom SearchWP Customizations Plugin.
Empêcher une catégorie spécifique d'être indexée avec les articles
Ne pas indexer le terme de catégorie Non classé lors de l'indexation.
| <?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 ); |

