+917803057266

Home » Tips & Tricks » Remove Version From CSS And JS

Remove Version From CSS And JS

To Remove Version parameter from your theme css or js file add the following code in functions.php

function eleminate_js_css_var( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'eleminate_js_css_var', 1000 );
add_filter( 'script_loader_src', 'eleminate_js_css_var', 1000 );

Alternatively…
You can set NULL to the fourth parameter on the wp_enqueue_style() or wp_enqueue_script()

That’s easy… 🙂