-
-
Save searchwpgists/095a97938554187e63b612181974c161 to your computer and use it in GitHub Desktop.
Customize taxonomy term before it is indexed by SearchWP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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