How to remove query string from static resources

It looks like you are using JetPack’s Photon which adds query strings to your URLs. According to this thread there is no way to remove them https://wordpress.org/support/topic/how-to-remove-photon-query-string?replies=2

If you want to get rid of the query strings I would suggest deactivating photon, using a CDN which does not add query strings, and using the snippet you mentioned:

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

Leave a Comment