Created
April 25, 2017 08:04
-
-
Save iworks/f5b95c994a545f0faa79b6789c650db6 to your computer and use it in GitHub Desktop.
Add random version number to scripts and styles 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( 'script_loader_src', 'iworks_add_random_version', 10, 2 ); | |
add_filter( 'style_loader_src', 'iworks_add_random_version', 10, 2 ); | |
function iworks_add_random_version( $src, $handle ) { | |
return add_query_arg( 'iv', rand(), $src ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment