searchwp\source\post\attributes\content
Da: 4.0.0
Indice
Personalizza il contenuto del post prima che venga indicizzato.
Parametri
| Tipo | Parametro | Predefinito | Da | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Stringa | $content |
Contenuto del post da indicizzare | 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 post durante l'indicizzazione
| <?php | |
| // Add additional content to post during indexing in SearchWP. | |
| add_filter( 'searchwp\source\post\attributes\content', function( $content, $args ) { | |
| if ( 48 !== $args['post']->ID ) { | |
| return $content; | |
| } | |
| // Add 'coffee" to the content for Page 48 so it can be searched. | |
| $content .= ' coffee'; | |
| return $content; | |
| }, 20, 2 ); |

