searchwp\source\post\attributes\comments\args
Since: 4.0.0
Table of Contents
Control the arguments used to retrieve Comments for a post during indexing.
Parameters
Type | Parameter | Default | Since | ||||||
---|---|---|---|---|---|---|---|---|---|
Array | $comments_args |
Array with defined post_id code for the current post |
4.0.0 |
||||||
Array |
$args
|
4.0.0 |
Examples
All hooks should be added to your custom SearchWP Customizations Plugin.
Include unapproved comments when indexing
This file contains 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 ); |