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
All hooks should be added to your custom SearchWP Customizations Plugin.
Personnaliser le terme de taxonomie avant son indexation
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 | |
| // 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 ); |

