searchwp\source\post\attributes\taxonomy\terms
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\term para filtrar términos individuales.
Parámetros
| Tipo | Parámetro | Predeterminado | Desde | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WP_Term[] | $términos |
Objetos de término de taxonomía | 4.0.0 |
||||||||||||
| Matriz |
$args
|
4.0.0 |
|||||||||||||
Ejemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Evitar que una categoría específica se indexe con las publicaciones
No indexar el término de categoría Sin categorizar al indexar.
| <?php | |
| // Prevent specific Category from being indexed with posts in SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\taxonomy\terms', function( $terms, $args ) { | |
| // Do not index the 'Uncategorized' term. | |
| return array_filter( $terms, function( $term ) { | |
| return 'Uncategorized' !== $term->name; | |
| } ); | |
| }, 20, 2 ); |

