searchwp\query\search_string
Desde: 4.0.0
Tabla de contenidos
Personaliza la cadena de búsqueda para una Consulta.
Parámetros
| Tipo | Parámetro | Predeterminado | Desde |
|---|---|---|---|
| Cadena | $search_string |
La cadena de búsqueda enviada | 4.0.0 |
| \SearchWP\Query | $query |
La consulta que se está ejecutando | 4.0.0 |
Ejemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Eliminar guiones de los códigos de producto al buscar
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 ); |

