2
2

More than 5 years have passed since last update.

WordpressでHTTPヘッダー(header())を飛ばす

Posted at

Wordpressのテンプレごにょって某ホスティングの自動挿入抑制(崩れるのを防ぐ苦肉の策)してるけどテンプレ(っていうか今回はプラグイン)更新したらまた消えちゃったのでメモ。

よく考えたらプラグイン作ってやって全テンプレで効くようにしておいたほうがよかったけど今回はめんどくさかったのでパス。

で、方法は簡単。function.phpとかにadd_actionを書いてやるだけ。

function.php
add_action( 'send_headers', 'add_header_xua' );
function add_header_xua() {
    header( 'X-UA-Compatible: IE=edge,chrome=1' );
}

参考

https://codex.wordpress.org/Plugin_API/Action_Reference/send_headers
http://wiki.grepgrape.net/index.php?WordPress/HTTP%E3%83%98%E3%83%83%E3%83%80%E3%83%BC%E3%81%AE%E9%80%81%E4%BF%A1

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2