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
All hooks should be added to your custom SearchWP Customizations Plugin.
Aggiungi contenuto aggiuntivo al campo personalizzato
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 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 ); |

