How to modify HTTP header?
-
Hello,
I am trying to modify http headers with your plugin.
So, I have created a simple snippet which do this:
add_filter('wp_headers', 'my_custom_headers');
function my_custom_headers($headers) {
// Add X-XSS-Protection header
if (!isset($headers['X-XSS-Protection'])) {
$headers['X-XSS-Protection'] = '1; mode=block;';
}
// Add X-Content-Type-Options header
if (!isset($headers['X-Content-Type-Options'])) {
$headers['X-Content-Type-Options'] = 'nosniff';
}
return $headers;
}But, $headers variables only contain “Content-Type” value.
In fact I would like to be able to check if headers have already being sent (from .htaccess by example) and be able to modify them.
So, what is the way to get http headers in order to control them with WPCode snippet?
Thanks in advance for your help and have a nice day.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.