Skip to content

Instantly share code, notes, and snippets.

@jonathanfann
Created January 16, 2018 16:53
Show Gist options
  • Save jonathanfann/7779426ed06d90e06fd6e875949a5e24 to your computer and use it in GitHub Desktop.
Save jonathanfann/7779426ed06d90e06fd6e875949a5e24 to your computer and use it in GitHub Desktop.
How to cache-bust css file changes on wordpress (only if file is updated)
$maincssupdate = filemtime($path . 'wp-content/themes/your_theme/static/gen/main.css');
wp_enqueue_style( 'your_theme_custom', get_template_directory_uri() . '/static/gen/main.css', array(), $maincssupdate, 'all');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment