常に最新のファイルや画像を表示する方法

cssや画像を修正しても変化しないことが稀にあります。キャッシュの影響ですが、この事象を回避する方法は画像や書類のファイル名にパラメーターを付加します。

?filemtime( );

stylecssなどは

<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>?<?php echo filemtime( get_stylesheet_directory() . '/style.css'); ?>">

画像は

<img src="<?php echo get_template_directory_uri(); ?>/images/logo.jpg?<?php echo filemtime(get_template_directory() . '/images/logo.jpg'); ?>" alt="">