Created
October 6, 2020 18:27
-
-
Save jchristopher/6b60c21d80823caf2341015b335bc8ce to your computer and use it in GitHub Desktop.
Add unique stopword(s) for a single SearchWP Engine
This file contains hidden or 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 | |
// Add unique stopword(s) for a single SearchWP Engine. | |
add_filter( 'searchwp\query\search_string', function( $search_string, $query ) { | |
// Remove "apple" and "orange" for my_engine searches. | |
if ( 'my_engine' === $query->get_engine() ) { | |
$search_string = str_replace( [ 'apple', 'orange' ], '', $search_string ); | |
} | |
return $search_string; | |
}, 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment