Remove Version Query String from Scripts and Styles

WordPress adds ?ver=X.X to CSS and JS files. Removing the version parameter can improve caching. Add to your functions.php file. For more tips on removing scripts and styles.

add_filter( 'script_loader_src', function( $src ) {
	return remove_query_arg( 'ver', $src );
}, 15, 1 );
add_filter( 'style_loader_src', function( $src ) {
	return remove_query_arg( 'ver', $src );
}, 15, 1 );
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!