searchwp\source\post\attributes\content
Depuis : 4.0.0
Table des matières
Personnaliser le contenu de l'article avant qu'il ne soit indexé.
Paramètres
| Type | Paramètre | Défaut | Depuis | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Chaîne de caractères | $content |
Contenu de l'article à indexer | 4.0.0 |
||||||
| Tableau |
$args
|
4.0.0 |
|||||||
Exemples
All hooks should be added to your custom SearchWP Customizations Plugin.
Ajouter du contenu supplémentaire à l'article lors de l'indexation
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 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 ); |

