Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created March 26, 2020 14:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jchristopher/62126e949d6fd8a0b726c6312ecf7716 to your computer and use it in GitHub Desktop.
Add additional content to post during indexing in SearchWP
<?php
// Add additional content to post during indexing in SearchWP.
add_filter( 'searchwp\source\post\attributes\content', function( $content, $args ) {
if ( 48 !== $args['post']->ID ) {
return $content;
}
// Add 'coffee" to the content for Page 48 so it can be searched.
$content .= ' coffee';
return $content;
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment