searchwp\source\post\attributes\taxonomy\terms
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\term para filtrar termos individuais.
Parâmetros
| Tipo | Parâmetro | Padrão | Desde | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WP_Term[] | $terms |
Objetos de Termo de Taxonomia | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Exemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Impedir que uma Categoria específica seja indexada com postagens
Não indexe o termo de Categoria Sem categoria ao indexar.
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 | |
| // 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 ); |

