Skip to content

Instantly share code, notes, and snippets.

@antcms antcms/force-style.php
Last active May 11, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.