filtrod 1.5.0
query_vars
Opis
Rejestruje własne zmienne zapytania (query vars) dostępne w URL.
Przykład użycia
add_filter( 'query_vars', ... )php
add_filter( 'query_vars', 'wpdocs_query_vars' );
function wpdocs_query_vars( $vars ) {
$vars[] = 'rok_wydania';
return $vars;
}
add_filter( 'query_vars', 'wpdocs_query_vars' );
function wpdocs_query_vars( $vars ) {
$vars[] = 'rok_wydania';
return $vars;
}Allows (publicly allowed) query vars to be added, removed, or changed prior to executing the query. Needed to allow custom rewrite rules using your own arguments to work, or any other custom query variables you want to be publicly available.
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$public_query_vars | string[] | The array of allowed query variable names. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_filter( 'query_vars', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}
// rejestracja funkcji zwrotnej
add_filter( 'query_vars', 'twoja_funkcja' );
function twoja_funkcja($param_1) {
// Twój kod
}Popularne w tej kategorii