Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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