Remove query strings from static resources – WordPress

Remove query strings from static resources – WordPress

this should do the job..
this removes the querystring on the frontend not the admin site.

Update: Add this into your functions.php file. Ensure that its kept within the PHP tags.

function rm_query_string( $src ){   
    $parts = explode( ?ver, $src );
    return $parts[0];
}

if ( !is_admin() ) {
    add_filter( script_loader_src, rm_query_string, 15, 1 );
    add_filter( style_loader_src, rm_query_string, 15, 1 );
}

This plugin will remove query strings from static resources like CSS & JS files, and will improve your speed scores in services like PageSpeed, YSlow, Pingdoom and GTmetrix.

Resources with a “?” or “&” in the URL are not cached by some proxy caching servers, and moving the query string and encode the parameters into the URL will increase your WordPress site performance significant.

Remove query strings from static resources – WordPress

// Remove Query String
function nerodev_remove_query_string($src) {
    $parts = explode(?ver=, $src);
    return $parts[0];
}
add_filter(script_loader_src, nerodev_remove_query_string, 15, 1);
add_filter(style_loader_src, nerodev_remove_query_string, 15, 1);

I found this here

Leave a Reply

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