searchwp\source\post\attributes\comments\args
Depuis : 4.0.0
Table des matières
Contrôler les arguments utilisés pour récupérer les commentaires d'un article lors de l'indexation.
Paramètres
| Type | Paramètre | Défaut | Depuis | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Tableau | $comments_args |
Tableau avec le code post_id défini pour l'article actuel |
4.0.0 |
||||||
| Tableau |
$args
|
4.0.0 |
|||||||
Exemples
All hooks should be added to your custom SearchWP Customizations Plugin.
Inclure les commentaires non approuvés 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 | |
| // Include unapproved comments when SearchWP indexes. | |
| add_filter( 'searchwp\source\post\attributes\comments\args', function( $comment_args, $args ) { | |
| $args['include_unapproved'] = true; | |
| return $args; | |
| }, 20, 2 ); |

