Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created March 16, 2022 17:37
Show Gist options
  • Save searchwpgists/095a97938554187e63b612181974c161 to your computer and use it in GitHub Desktop.
Save searchwpgists/095a97938554187e63b612181974c161 to your computer and use it in GitHub Desktop.
Customize taxonomy term before it is indexed by SearchWP
<?php
// Customize taxonomy term before it is indexed by SearchWP.
add_filter( 'searchwp\source\post\attributes\taxonomy\term', function( $term, $args ) {
// Add 'coffee' to specific term name so it is searchable.
if ( 'My Custom Term' === $term->name ) {
$term->name .= ' coffee';
}
return $term;
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment