Skip to content

Instantly share code, notes, and snippets.

@ethanclevenger91
Created November 20, 2014 15:50
Show Gist options
  • Save ethanclevenger91/595ee21a082e919cd900 to your computer and use it in GitHub Desktop.
Save ethanclevenger91/595ee21a082e919cd900 to your computer and use it in GitHub Desktop.
Automated Cache Busting. This works by adding the file's change time to the end of the url (last argument of the call)
<?php
wp_enqueue_style('slug', get_template_directory_uri().'/css/slug.css', array(), filemtime(get_template_directory().'/css/slug.css'));
wp_enqueue_script('slug', get_template_directory_uri().'/js/slug.js', array(), filemtime(get_template_directory().'/js/slug.js'));
//Note the second argument is URL based while the last argument is a file path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment