searchwp\query\search_string
Desde: 4.0.0
Sumário
Personalize a string de pesquisa para uma Consulta.
Parâmetros
| Tipo | Parâmetro | Padrão | Desde |
|---|---|---|---|
| String | $search_string |
A string de pesquisa enviada | 4.0.0 |
| \SearchWP\Query | $query |
A consulta que está sendo executada | 4.0.0 |
Exemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Remover hífens de códigos de produto ao pesquisar
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 ); |

