2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

wordpressでドキュメントの有効期限切れ対策

Posted at

現象

POSTで検索結果を送信した後にブラウザバックするとこれが出る。
スクリーンショット 2020-05-13 13.11.57.png

対策

バージョン

wordpress 5.4.1

対策方法

これをfunctions.phpに貼り付けたら終わり。

function add_header_session() {
	header("Cache-Control: private");
	header("Pragma: no-cahce");
	header("Expires: ");
	header("Last-Modified: ");
}
add_action( 'send_headers', 'add_header_session' );

備考

調べると以下のような対応方法も出てきますが、wordpressだとうまくいかないです。

session_cache_limiter("none");
// or
session_cache_limiter("private_no_expire");
// をsession_start()の前につける
2
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?