Created
February 23, 2012 13:21
-
-
Save GaryJones/1892762 to your computer and use it in GitHub Desktop.
Cache bust the style.css reference in WordPress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'stylesheet_uri', 'gmj_stylesheet_uri' ); | |
/** | |
* Cache bust the style.css reference. | |
* | |
* Includes the file last modified time as a querystring. | |
* | |
* @author Gary Jones | |
* @link https://gist.github.com/1892762 | |
* | |
* @param string $stylesheet_uri Existing URI to style.css. | |
* | |
* @return string Amended URI to style.css. | |
*/ | |
function gmj_stylesheet_uri( $stylesheet_uri ) { | |
return add_query_arg( 'v', filemtime( get_stylesheet_directory() . '/style.css' ), $stylesheet_uri ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment