Created
December 8, 2013 02:12
-
-
Save jchristopher/7852506 to your computer and use it in GitHub Desktop.
Customize the query submitted to SearchWP before the search actually takes place
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 | |
// if your visitors commonly misspell "soccer" as "socer" you can fix that for them | |
function my_parse_searchwp_terms( $query, $engine ) { | |
if( false !== strpos( strtolower( $query ), 'socer' ) ) { | |
$query = str_replace( 'socer', 'soccer', strtolower( $query ) ); | |
} | |
return $query; | |
} | |
add_filter( 'searchwp_terms', 'my_parse_searchwp_terms', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment