searchwp\source\post\attributes\meta
Da: 4.0.0
Indice
Manipola i dati del campo personalizzato (postmeta) prima che vengano indicizzati.
Vedi anche searchwp\source\post\attributes\meta\${meta_key} per un singolo campo personalizzato.
Parametri
| Tipo | Parametro | Predefinito | Da | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Misto | $meta_value |
Valore del campo personalizzato (dopo essere stato elaborato da searchwp\source\post\attributes\meta\${meta_key}) |
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 al campo personalizzato
| <?php | |
| // Add additional content to Custom Field during indexing in SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\meta', function( $meta_value, $args ) { | |
| if ( 'my_custom_field_key' !== $args['meta_key'] ) { | |
| return $meta_value; | |
| } | |
| // Add 'coffee' to Custom Field value to make it searchable. | |
| return $meta_value[0] . ' coffee'; | |
| }, 20, 2 ); |

