Last active
May 11, 2017 01:02
-
-
Save antcms/6409db3a835335e4c054bebf9bc69bcc to your computer and use it in GitHub Desktop.
Force Wordpress Styles to Update
This file contains 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
//ADD THIS TO YOUR functions.php FILE | |
//REMOVES VERSION NUMBERS AND REPLACES WITH A RANDOM NUMBER SO STYLE SHEET RELOADS EVERY TIME | |
function remove_replace_css_ver( $src ) { | |
if ( strpos( $src, 'ver=' ) ) | |
$src = remove_query_arg( 'ver', $src ); | |
$newsrc = $src . '?ver=' . rand(111,9999); | |
return $newsrc; | |
} | |
add_filter( 'style_loader_src', 'remove_replace_css_ver', 9999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment