Cannot remove query strings from static resources (images in media library)
-
I’m trying to optimize my website using gtmetrix. The biggest issure for me is “Remove query strings from static resources”, in which my grade is an F(32). It lists all of the images I have uploaded to the media library and used in my posts.
I have tried the settings in W3 Total Cache, I’ve added the following code into the functions.php file in my child-theme:
/*** 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 );
I’ve enabled the “Rewrite URL structure If disabled, CSS and JS embeddings will use GET variables instead of “fancy” links.” under Minify settings, but yet I still get met with the same score in gtmetrix.
In gtmetrix, all of the things it lists have something similar to the following:
*.jpg?resize=1024%2C766
I even tried the “Remove query strings from static resources” plugins. Nothing I do seems to fix my issue…
Can anyone help me out? Does any of what I have tried even affect images that I uploaded? Or am I going down the wrong path entirely?
- The topic ‘Cannot remove query strings from static resources (images in media library)’ is closed to new replies.