I am using a wordpress theme, and the css file uploads with version number: style.css?ver=1.2.8
The problem is that when i change the css file, the browser keep loading the file without my changes. I can see that the changes were saved on the server, but nothing help to load the right file.
I tried:
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
But everything disappeared.
I read the other topics on the subject but nothing helped.
Thank you.
That below given code may help you.
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, 'ver=' . get_bloginfo( 'version' ) ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
Taken from https://wordpress.stackexchange.com/questions/132282/removing-wordpress-version-number-from-included-files
That works for me, hope it will work for you as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With