Last active
April 14, 2021 13:52
-
-
Save Preciousomonze/e252e21898693797aaf057f97766fb79 to your computer and use it in GitHub Desktop.
Cache-bust all scripts/styles
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 | |
/** | |
* Cache-bust all scripts/styles. form helgatheviking | |
* | |
* Can go to your functions.php. | |
* Useful for development purposes. | |
* Special thanks to HelgaTheViking. | |
*/ | |
function pekky_add_timestamp_css_js( $src ) { | |
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { | |
$src = add_query_arg( 'time', time(), $src ); | |
} | |
return $src; | |
} | |
add_filter( 'style_loader_src', 'pekky_add_timestamp_css_js', 9999 ); | |
add_filter( 'script_loader_src', 'pekky_add_timestamp_css_js', 9999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment