searchwp\query\partial_matches\tokens
Da: 4.0.0
Indice
Manipola i token di corrispondenza parziale durante l'applicazione della logica di corrispondenza parziale.
Parametri
| Tipo | Parametro | Predefinito | Da | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| String[] | $partial_tokens |
Token di corrispondenza parziale trovati da SearchWP | 4.0.0 |
||||||||||||
| Array |
$args
|
4.0.0 |
|||||||||||||
Esempi
All hooks should be added to your custom SearchWP Customizations Plugin.
Aggiungi sempre 'caffè' alle corrispondenze parziali anche se non lo è
Se desideri aggiungere sempre la parola “caffè” all'elenco delle corrispondenze parziali:
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 ); |

