Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created March 16, 2022 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searchwpgists/ed7dc984c798ef2036f46a400cd8d8f5 to your computer and use it in GitHub Desktop.
Save searchwpgists/ed7dc984c798ef2036f46a400cd8d8f5 to your computer and use it in GitHub Desktop.
Add additional content to comment during indexing in SearchWP
<?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;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment