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
All hooks should be added to your custom SearchWP Customizations Plugin.
Personalizza il termine della tassonomia prima che venga indicizzato
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 ); |

