-
-
Save searchwpgists/c283bd34a067c59be88fa1d6493bfaed to your computer and use it in GitHub Desktop.
Add custom regular expression pattern to 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 | |
// Add custom regular expression pattern to SearchWP. | |
add_filter( 'searchwp\tokens\regex_patterns', function( $patterns ) { | |
$my_patterns = [ | |
"/([0-9]{1,2}\\/[0-9]{1,2})/is", // Retain measurement details. | |
]; | |
// We want our pattern to be considered top priority. | |
return array_merge( $my_patterns, $patterns ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment