Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created March 16, 2022 16:24
Show Gist options
  • Save searchwpgists/a3ca3fcfa7c62d530555b2f1a72aec3d to your computer and use it in GitHub Desktop.
Save searchwpgists/a3ca3fcfa7c62d530555b2f1a72aec3d 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