Is there a dedicated WP function, action or filter to use when adding/modifying the HTTP headers?
For now I just hook a PHP header() call into the WP ‘init’ hook like this:
add_action('init', 'add_header_xua');
function add_header_xua(){
if(!is_admin()){
header('X-UA-Compatible: IE=edge,chrome=1');
}
}
But is this the correct way to do that?
The init action is the wrong place to do it. A better place would be at template_redirect, so that you only affect the front end view of the site and not the admin areas.