Skip to content

Instantly share code, notes, and snippets.

View drewrawitz's full-sized avatar

Drew Rawitz drewrawitz

View GitHub Profile
@drewrawitz
drewrawitz / automated-cache-busting.php
Created November 30, 2015 20:57 — forked from kjbrum/wp-automated-cache-busting.php
Automated Cache Busting. This works by adding the file's change time to the end of the url (last argument of the call)
<?php
/* For Themes */
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'));
/* For Plugins */
wp_enqueue_style('slug', plugin_dir_url(__FILE__).'css/slug.css', array(), filemtime(plugin_dir_path(__FILE__).'css/slug.css'));
wp_enqueue_script('slug', plugin_dir_url(__FILE__).'js/slug.js', array(), filemtime(plugin_dir_path(__FILE__).'js/slug.js'));