Remove query string except from google map api

First of all I would like to strongly recommend you to not remove query parts of javascript and stylesheet files. Why? Because they contain a version of a file.

Why do I need it for? We need to add version to each file (whenever it is possible) to prevent versions collisions. These collisions could appear when a new version of WP/plugin is released and you update it from admin panel. In this case, your users’ browser won’t be notified that a new version of a script exists and won’t download it, but will use previous one which is stored in browser cache.

But if you strongly confident that you don’t need it and still want to trim query strings, you can do it by changing your function to the following view:

function _remove_script_version( $src ){
    return add_query_arg( 'ver', false, $src );
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );