Remove Query String From Static Resources

Remove Query Strings from Static Resources on WordPress

If you have tested your site speed using any tools like GTmetrix, Pingdom, etc. you might have noticed this, “Remove query string from static resources“.

So, here I’ll show you how to remove that error.

What are Query Strings?

Query strings are the URLs containing “&” and “?” in it.

Something like this,


Pingdom tools.
Pingdom tools.

Query strings are the URLs that you see containing special characters such as “&” and “?”. The query strings are seen in the scripts and stylesheets.

It causes caching issues and it is important to remove those Query strings. Even CDNs can’t help you if you don’t remove Query Strings from static resources.

You can’t ignore this if you know how important the site speed is. Google loves quality content and the content with quality ranks on Google. But Google looks many other factors while ranking a site. And the speed is one among the top factors in it.

People won’t wait for your site to load, even if your’s is the best content. So, there would be an increase in bounce rate which will affect your site’s ranking in Search Engine.

How to Remove Query String From Static Resources

WordPress users, you can do it in two different ways,

  • Using a WordPress plugin
  • Manually adding a code in functions.php

#1. Using WordPress Plugin – Remove Query String From Static Resources

Remove Query Strings From Static Resources — WordPress Plugins
Remove Query Strings From Static Resources — WordPress Plugins

Install this plugin on your self-hosted WordPress site and it will remove the query strings. This is a lightweight plugin.

If you are comfortable editing the functions.php of your WordPress site, you can follow the manual method and avoid installing a plugin.

#2. Manually editing functions.php

Open your functions.php and add this at the end of the file.

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 );
You can save those changes and check the speed again to verify it.

Partner Posts

Adarsh.M is a blogger, web designer, Brand Strategist at BlogBing and a Student from Thalassery, Kerala, India. He writes about WordPress, SEO and marketing on and his other blogs.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.