Remove Versioning in WordPress CSS and JS Scripts

Remove versioning from CSS and JS scripts in your WordPress theme. This helps increase page speed scores and isn’t needed past development.

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 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Scroll to Top