Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created March 27, 2020 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/9d373baec3fda02c2dafaae5d20ce5f3 to your computer and use it in GitHub Desktop.
Save jchristopher/9d373baec3fda02c2dafaae5d20ce5f3 to your computer and use it in GitHub Desktop.
Remove hyphens from product codes when searching in SearchWP
<?php
// Remove hyphens from product codes when searching in SearchWP.
add_filter(
'searchwp\query\search_string',
function( $search_string, $query ) {
return str_replace( '-', '', $search_string );
},
30, 2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment