ブラウザのキャッシュの影響を受けないようにする

../style.cssを再読込してください、とかやってたんですが、異様にそういったデータが多い場合、ちょっと無理があるなと、方法を調べてみました。

CSSやJavaScriptなどのキャッシュを回避!ファイルを更新したタイミングで再読み込みさせる方法(WordPress版)

https://www.kansuke-prg.com/wordpress/cache_avoidance

「キャッシュの削除お願いします」をなくせ!強制的にCSSのキャッシュを無効化する2つの方法

https://haniwaman.com/cache-delete/

jQueryで全部の画像のキャッシュを強制更新してみた

https://spc-jpn.co.jp/blog/7431/

上記の参考URLのとおりなのですが、

style.css?191012

などを付ける方法と、

画像にjqueryでそういった接尾後をつける方法です





$(function () { $(‘img’).each(function() { //imgタグがある限り繰り返し実行 var imgSrc = $(this).attr(‘src’); //画像のソースURLを取得し、変数に格納 $(this).attr(‘src’, imgSrc + ‘?v=<?php echo filemtime(get_template_directory().’/assets/img’); ?>’); //本来のソースURLをクエリパラメータ付きURLで置換 }); });

 

Warning: Trying to access array offset on value of type bool in /home/handa-soft/www/sunnet-jp.com/tech/wp-content/themes/basepress/inc/base-template-functions.php on line 1052

Warning: Trying to access array offset on value of type bool in /home/handa-soft/www/sunnet-jp.com/tech/wp-content/themes/basepress/inc/base-template-functions.php on line 1053

Warning: Trying to access array offset on value of type bool in /home/handa-soft/www/sunnet-jp.com/tech/wp-content/themes/basepress/inc/base-template-functions.php on line 1054