Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created March 26, 2020 15:17
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 jchristopher/49e6201760f8f567d177f502bc5b520c to your computer and use it in GitHub Desktop.
Save jchristopher/49e6201760f8f567d177f502bc5b520c 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