searchwp\source\post\attributes\taxonomy\term
Da: 4.0.0
Indice
Manipola i termini della tassonomia per un post prima dell'indicizzazione. Si applica solo quando la Tassonomia è stata inclusa in un Motore.
Vedi anche searchwp\source\post\attributes\taxonomy\terms per filtrare tutti i termini contemporaneamente.
Parametri
| Tipo | Parametro | Predefinito | Da | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| \WP_Term | $term |
Termine in fase di indicizzazione | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Esempi
Tutti gli hook dovrebbero essere aggiunti al tuo plugin personalizzato SearchWP Customizations Plugin.
Personalizza il termine della tassonomia prima che venga indicizzato
| <?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 ); |

