WP HOOKS
filtrod 1.5.0

query_vars

Args 1Plik wp-includes/class-wp.phpDokumentacja WP ↗

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;
}

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

ParametrTypOpis
$public_query_varsstring[]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
}

Popularne w tej kategorii