filtrod 2.8.0
wp_headers
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;
}
add_filter( 'wp_headers', 'wpdocs_extra_headers' );
function wpdocs_extra_headers( $headers ) {
$headers['X-Content-Type-Options'] = 'nosniff';
return $headers;
}Parametry
| Parametr | Typ | Opis |
|---|---|---|
$headers | string[] | Associative array of headers to be sent. |
$wp | \WP | Current 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
}
// 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