searchwp\source\post\attributes\taxonomy\term
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\terms pour filtrer tous les termes à la fois.
Paramètres
| Type | Paramètre | Défaut | Depuis | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| \WP_Term | $term |
Terme en cours d'indexation | 4.0.0 |
||||||||||||
| Tableau |
$args
|
4.0.0 |
|||||||||||||
Exemples
Tous les hooks doivent être ajoutés à votre plugin personnalisé SearchWP Customizations Plugin.
Personnaliser le terme de taxonomie avant son indexation
| <?php | |
| // Customize taxonomy term before it is indexed by SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\taxonomy\term', function( $term, $args ) { | |
| // Add 'coffee' to specific term name so it is searchable. | |
| if ( 'My Custom Term' === $term->name ) { | |
| $term->name .= ' coffee'; | |
| } | |
| return $term; | |
| }, 20, 2 ); |

