Skip to main content
AS wp_headers is a filter, you need to change the current array of headers.
Source Link

Here is the code I've used, based on the original question and on Dominic P's answer...

/*
 * Modify HTTP header
 */
function add_header_xua($headers) {
    
    // var_dump($headers); #=> if you want to see the current headers...  

    if (!is_admin()) {
        header('X$headers['X-UA-Compatible:Compatible'] IE=edge= 'IE=edge,chrome=1');chrome=1';    
    }

    return $headers;     
}
add_filter('wp_headers', 'add_header_xua');

Once you've added that code to your functions.php file, you can check it works by running a test at http://web-sniffer.net/ to ensure the HTTP headers have indeed changed.

Here is the code I've used, based on the original question and on Dominic P's answer...

/*
 * Modify HTTP header
 */
function add_header_xua() {
    if(!is_admin()) {
        header('X-UA-Compatible: IE=edge,chrome=1');    
    }
}
add_filter('wp_headers', 'add_header_xua');

Once you've added that code to your functions.php file, you can check it works by running a test at http://web-sniffer.net/ to ensure the HTTP headers have indeed changed.

Here is the code I've used, based on the original question and on Dominic P's answer...

/*
 * Modify HTTP header
 */
function add_header_xua($headers) {
    
    // var_dump($headers); #=> if you want to see the current headers...  

    if (!is_admin()) {
        $headers['X-UA-Compatible'] = 'IE=edge,chrome=1';    
    }

    return $headers;     
}
add_filter('wp_headers', 'add_header_xua');

Once you've added that code to your functions.php file, you can check it works by running a test at http://web-sniffer.net/ to ensure the HTTP headers have indeed changed.

Source Link
Boycott A.I.
  • 158
  • 11
  • 23

Here is the code I've used, based on the original question and on Dominic P's answer...

/*
 * Modify HTTP header
 */
function add_header_xua() {
    if(!is_admin()) {
        header('X-UA-Compatible: IE=edge,chrome=1');    
    }
}
add_filter('wp_headers', 'add_header_xua');

Once you've added that code to your functions.php file, you can check it works by running a test at http://web-sniffer.net/ to ensure the HTTP headers have indeed changed.