Created
March 26, 2020 15:17
-
-
Save jchristopher/49e6201760f8f567d177f502bc5b520c 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