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[] | $termes |
Objets de terme de taxonomie | 4.0.0 |
||||||||||||
| Tableau |
$args
|
4.0.0 |
|||||||||||||
Exemples
Tous les hooks doivent être ajoutés à votre plugin personnalisé 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 ); |

