searchwp\query\search_string
Depuis : 4.0.0
Table des matières
Personnaliser la chaîne de recherche pour une requête.
Paramètres
| Type | Paramètre | Défaut | Depuis |
|---|---|---|---|
| Chaîne | $search_string |
La chaîne de recherche soumise | 4.0.0 |
| \SearchWP\Query | $requête |
La requête en cours d'exécution | 4.0.0 |
Exemples
All hooks should be added to your custom SearchWP Customizations Plugin.
Supprimer les traits d'union des codes produit lors de la recherche
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 | |
| // 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 ); |

