searchwp\source\post\attributes\taxonomy\term
Desde: 4.0.0
Tabla de contenidos
Manipula los términos de la taxonomía de una entrada antes de indexarlos. Solo se aplica cuando la taxonomía se ha incluido en un motor.
Véase también searchwp\source\post\attributes\taxonomy\terms para filtrar todos los términos a la vez.
Parámetros
| Tipo | Parámetro | Predeterminado | Desde | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| \WP_Term | $term |
Término que se está indexando | 4.0.0 |
||||||||||||
| Matriz |
$args
|
4.0.0 |
|||||||||||||
Ejemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Personaliza el término de la taxonomía antes de que se indexe
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 ); |

