How to remove query strings

Resources with a question mark in them are called query strings and cannot be cached by many proxy servers and could affect your site’s loading speed. In this video I will show you how to remove query strings from static resources.

 

If using a plugin is not an option, add the following code in your child theme’s functions.php
/*** Remove Query String from Static Resources ***/
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 );