searchwp\document\content
Depuis : 4.0.0
Table des matières
Personnalisez le contenu du document extrait.
Paramètres
| Type | Paramètre | Défaut | Depuis |
|---|---|---|---|
| Chaîne | $content |
Contenu extrait | 4.0.0 |
| \WP_Post | $the_post |
Pièce jointe en cours d'indexation | 4.0.0 |
Exemples
Tous les hooks doivent être ajoutés à votre plugin personnalisé SearchWP Customizations Plugin.
Personnaliser le contenu du document avant son indexation
| <?php | |
| // Customize document content before it is indexed by SearchWP. | |
| add_filter( 'searchwp\document\content', function( $content, $the_post ) { | |
| if ( 18 === $the_post->ID ) { | |
| // Add 'coffee' to the document content so it can be searched. | |
| $content .= ' coffee'; | |
| } | |
| return $content; | |
| }, 10, 2 ); |

