searchwp\source\post\attributes\taxonomy\term
Seit: 4.0.0
Manipulieren Sie die Taxonomiebegriffe für einen Beitrag vor der Indizierung. Gilt nur, wenn die Taxonomie in eine Engine aufgenommen wurde.
Siehe auch searchwp\source\post\attributes\taxonomy\terms zum Filtern aller Begriffe auf einmal.
Parameter
| Typ | Parameter | Standard | Seit | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| \WP_Term | $term |
Zu indexierender Begriff | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Beispiele
All hooks should be added to your custom SearchWP Customizations Plugin.
Taxonomiebegriff vor der Indexierung anpassen
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 ); |

