searchwp\source\post\attributes\taxonomy\term
Desde: 4.0.0
Sumário
Manipule os termos de taxonomia para uma postagem antes da indexação. Aplica-se apenas quando a Taxonomia foi incluída em um Motor.
Veja também searchwp\source\post\attributes\taxonomy\terms para filtrar todos os termos de uma vez.
Parâmetros
| Tipo | Parâmetro | Padrão | Desde | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| \WP_Term | $term |
Termo sendo indexado | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Exemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Personalize o termo da taxonomia antes que ele seja indexado
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 ); |

