WP HOOKS
filtrod 2.8.0

wp_headers

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

Opis

Modyfikuje nagłówki HTTP wysyłane przez WordPress.

Przykład użycia

add_filter( 'wp_headers', ... )php
add_filter( 'wp_headers', 'wpdocs_extra_headers' );

function wpdocs_extra_headers( $headers ) {
	$headers['X-Content-Type-Options'] = 'nosniff';
	return $headers;
}

Parametry

ParametrTypOpis
$headersstring[]Associative array of headers to be sent.
$wp\WPCurrent WordPress environment instance.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'wp_headers', 'twoja_funkcja', 10, 2 );

function twoja_funkcja($param_1, $param_2) {
	// Twój kod
}

Popularne w tej kategorii