searchwp\source\post\attributes\meta\{$meta_key}
Da: 4.0.0
Indice
Manipola i dati del campo personalizzato (postmeta) per un singolo campo personalizzato prima che venga indicizzato.
Vedi anche searchwp\source\post\attributes\meta\${meta_key} per tutti i campi personalizzati.
Parametri
| Tipo | Parametro | Predefinito | Da | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Misto | $meta_value |
Valore del campo personalizzato | 4.0.0 |
||||||
| Array |
$args
|
4.0.0 |
|||||||
Esempi
Tutti gli hook dovrebbero essere aggiunti al tuo plugin personalizzato SearchWP Customizations Plugin.
Aggiungi contenuto aggiuntivo a un campo personalizzato specifico durante l'indicizzazione in SearchWP
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 | |
| // Add additional content to a specific Custom Field during indexing in SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\meta\my_custom_field_key', function( $meta_value, $args ) { | |
| // Add 'coffee' to Custom Field value to make it searchable. | |
| return $meta_value[0] . ' coffee'; | |
| }, 20, 2 ); |
