WordPress Function to remove querystring version numebrs

WordPress Function to remove querystring version numebrs

A really simple WordPress function to remove querystring version numbers from wp_enqueue_style and wp_enqueue_script. Just add the following code in your themes functions.php file:

function _remove_script_version( $src ){
$parts = explode( '?', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );