apply_filters( 'relevanssi_get_approved_comments_args', array $args )

Filters the arguments for get_approved_comments() used in comment indexing.


(array) The arguments for get_approved_comments(). By default Relevanssi provides offset, number and type.

More information

Relevanssi uses get_approved_comments() to fetch the comments for each posts when indexing the comments. The comments are fetched 20 at the time, since posts can have lots of comments. It’s important to preserve the offset and number parameters Relevanssi sets; touching or removing them will break the comment indexing. Also do not touch post_id, count, hierarchical or other arguments that affect the format of things returned.

You can find the list of possible arguments here. This might give you some ideas of what can be done with this filter hook (not much, really). Perhaps you want to only index comments from yourself (user ID 1), and not from anybody else? This is how you’d do that:

add_filter( 'relevanssi_get_approved_comments_args', function ( $args ) {
  $args['user_id'] = 1;
  return $args;
} );