SearchWP

searchwp\source\post\attributes\comment

Since: 4.0.0

Table of Contents

Customize a Comment before it is indexed.

Parameters

Type Parameter Default Since
Object $comment The comment being indexed 4.0.0

Examples

All hooks should be added to your custom SearchWP Customizations Plugin.

Add additional content to comment during indexing

<?php
// Add additional content to comment during indexing in SearchWP.
add_filter( 'searchwp\source\post\attributes\comment', function( $comment ) {
// Add 'coffee" to the comment content so it can be searched.
$comment->comment_content .= ' coffee';
return $comment;
} );

How to use this code