searchwp\query\partial_matches\tokens
Desde: 4.0.0
Sumário
Manipule tokens de correspondência parcial durante a aplicação da lógica de correspondência parcial.
Parâmetros
| Tipo | Parâmetro | Padrão | Desde | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| string[] | $partial_tokens |
Tokens de correspondência parcial encontrados por SearchWP | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Exemplos
All hooks should be added to your custom SearchWP Customizations Plugin.
Sempre adicione 'café' às correspondências parciais mesmo que não esteja
Se você gostaria de sempre adicionar a palavra “café” à lista de correspondências parciais:
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 | |
| // Always add 'coffee' to partial matches even if it's not. | |
| add_filter( 'searchwp\query\partial_matches\tokens', function( $partial_match_tokens, $args ) { | |
| $partial_match_tokens[] = 'coffee'; | |
| return $partial_match_tokens; | |
| }, 10, 2 ); |

