Skip to content

Commit 01ba75e

Browse files
jack-arturoclaude
andcommitted
Fix CSS/JS caching with filemtime versioning
Use file modification time instead of static version numbers to ensure browser cache is busted on each deploy. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ce39e64 commit 01ba75e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

functions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ function minimalcode_setup() {
5858
* Enqueue scripts and styles
5959
*/
6060
function minimalcode_scripts() {
61-
// Main stylesheet
62-
wp_enqueue_style('minimalcode-style', get_stylesheet_uri(), array(), '1.0.0');
63-
61+
// Main stylesheet - use filemtime for cache busting
62+
wp_enqueue_style('minimalcode-style', get_stylesheet_uri(), array(), filemtime(get_stylesheet_directory() . '/style.css'));
63+
6464
// Custom styles
65-
wp_enqueue_style('minimalcode-custom', get_template_directory_uri() . '/assets/css/custom.css', array(), '1.0.0');
65+
wp_enqueue_style('minimalcode-custom', get_template_directory_uri() . '/assets/css/custom.css', array(), filemtime(get_template_directory() . '/assets/css/custom.css'));
6666

6767
// Prism.js for code highlighting (dark mode compatible)
6868
wp_enqueue_style('prismjs', 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css', array(), '1.29.0');
@@ -81,7 +81,7 @@ function minimalcode_scripts() {
8181
}
8282

8383
// Theme toggle script
84-
wp_enqueue_script('minimalcode-theme', get_template_directory_uri() . '/assets/js/theme.js', array(), '1.0.0', true);
84+
wp_enqueue_script('minimalcode-theme', get_template_directory_uri() . '/assets/js/theme.js', array(), filemtime(get_template_directory() . '/assets/js/theme.js'), true);
8585

8686
// Comment reply script
8787
if (is_singular() && comments_open() && get_option('thread_comments')) {

0 commit comments

Comments
 (0)