searchwp\source\post\attributes\taxonomy\terms
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\term per filtrare singoli termini.
Parametri
| Tipo | Parametro | Predefinito | Da | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WP_Term[] | $terms |
Oggetti termine tassonomia | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Esempi
All hooks should be added to your custom SearchWP Customizations Plugin.
Impedisci l'indicizzazione di una Categoria specifica con i post
Non indicizzare il termine della Categoria Senza categoria durante l'indicizzazione.
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 ); |

