Skip to main content
Tweeted twitter.com/StackWordPress/status/685453761377075200
added 29 characters in body; added 12 characters in body
Source Link
mikkelbreum
  • 2.5k
  • 5
  • 28
  • 34

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?

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(){
    header('X-UA-Compatible: IE=edge,chrome=1');    
}

But is this the correct way to do that?

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?

Source Link
mikkelbreum
  • 2.5k
  • 5
  • 28
  • 34

WP function/filter for modifying http headers?

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(){
    header('X-UA-Compatible: IE=edge,chrome=1');    
}

But is this the correct way to do that?