Skip to content

Instantly share code, notes, and snippets.

@antcms
Last active May 11, 2017 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antcms/6409db3a835335e4c054bebf9bc69bcc to your computer and use it in GitHub Desktop.
Save antcms/6409db3a835335e4c054bebf9bc69bcc to your computer and use it in GitHub Desktop.
Force Wordpress Styles to Update
//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