How to Remove Query String From Static Resources

Query String

How to remove query string from static resources is a common question faced by many websites while trying the increase page load time.

WordPress websites are fast. However, when you start building your site and add new plugins, it becomes relatively slow compared to the vanilla WordPress. No one wants to use vanilla WordPress anyway.

Now, when you go check your website speed through popular speed tools such as Google PageSpeed, GTMetrix, Pingdom, you will see that it asks you to remove static sources from your website. Let’s see an example below.

remove query string

The query strings can slow down any website, and Google is clear on this and has already announced how query strings impact the loading time of a site.

Google PageSpeed Insights Rules clearly explains how to leverage browser caching. Any URL with query string will not be cached. Query Strings make it harder for the website to leverage browser caching and increases page load time.

Before we go deep into this article, here is a fix to another common issue about the database. Here is how you can fix the common issue regarding error establishing a database connection.

What are Query Strings?

Query Strings. So, what exactly they do or mean? Let’s explore.

Query strings are the URLs that consists of “?” or “&.” As you know, URL with query strings are not cached at all. Every time a user requests your website, the cache is ignored for any resources that have a Query String associated with it.

Moreover, not only browser cache but also popular CDN’s ignore URL with Query Strings. Keeping all the facts in mind, it is important for the website owner to completely remove Query String from the URL requests when loading a website.

Also Read: Best Free CDN Services to Speed Up WordPress

Why Should You Remove Query Strings?

There are multiple benefits of removing Query Strings from your website. The first benefit is less server load. It also means that the site loads faster. And the most important benefit of the Query Strings removal is higher Page Speed Score(Grade). Higher grade helps in improving the website’s visibility in Google search.

How to Remove Query Strings from Static Resources

There are many ways you can remove Query Strings from static resources. To make it easy for you to remove Query Strings using Plugin and manually. Let’s start with plugin first.

WordPress Plugins to Remove Query String


W3 Total Cache

W3Total Cache is one of the most popular cache plugins for WordPress websites. If you have it installed as your primary cache plugin, you just need to turn on one option, and Query Strings will now not be served by the server.

To do so, you need to go to “Browser Cache” option in the sidebar and then click on “Prevent caching of objects after settings change.” That’s it! You are all set.



WP Rocket

WP Rocket is one of the leading WordPress cache plugins that will instantly improve your site’s performance after activation.

The best part about this plugin is the simplicity, you don’t have to go through long technical settings options that half of the WordPress users don’t understand.

This plugin gives you the option to remove the query string from static resources as well. You will find the WP Rocket settings under the WordPress admin settings tab.

Go to settings > WP Rocket > static files, there you will find the option to remove query string; you just have to tick the option.

Remove query strings from static resources

Remove Query Strings From Static Resources Plugin by Your WP Expert

 If you are not using W3 Total Cache and don’t plan to install it as it conflicts with your site setup, you might want to try a dedicated plugin.

“Remove Query String From Static Resources” is a WordPress plugin that lets you do just that. The plugin is simple to use. All you need to do is download and install into your WordPress website.

Once done, it will automatically activate and do the required job. There is no need to do anything else.

Yes, you read it right. No settings panel, no activation. Simple, install and activate.

remove query strings from static resources

Query String Remover

Yet another plugin for the simple job. The plugin is lightweight and is free of cost. All you need to do it go to the WordPress plugin repository and download the plugin.

This plugin also doesn’t have any settings panel and it auto-activated once installed. To check if it works as intended, you need to purge the cache and test it on one of the speed test websites. If it shows no query string, the plugin worked!

Query Strings Remover


Remove Query Strings From Static Resources by LittleBizzy

We want to make sure that you get as many options as possible. So this is yet another plugin that does the task of removing Query Strings from the static resources.

To make it work, you need to download it and activate. No customization required.

Remove Query Strings From Static Resources


Zendy Speed: Query Strings

Improvement in PageSpeed is highly beneficial for the competitive sites. A single point can add a lot of value in the eyes of the Google.

Zendy Speed is a plugin dedicated to improving PageSpeed number by removing Query Strings from the URLs.

Query Strings


Manual method

It’s all about choice and good decision. Many websites don’t want to bloat their website with plugins. That’s why they like to tinker the code to meet their requirements.

Removing Query Strings is not hard if you know what you are doing. If you know how to code, then you can actually code the solution into your WordPress website. Let’s see the code below.

function _remove_script_version( $src )

{ $parts = explode( ‘?’, $src );

return $parts[0];


add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );

add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );

That’s 6 lines of code. All you need to do is copy the above code and add it to the WordPress theme’s functions.php file. Easy, right?

However, be sure that you do it right as it can easily make things worse and can also break your site to the point where it doesn’t open at all.

To access the functions.php file, you need to go to Appearance -> Editor -> and then choose the functions.php file.

If you the right administrative privileges, you should be able to edit the file directly there. If not, you need to either use an FTP client or go to the cPanel and then “File Manager.”



Removing Query Strings from Static Resources is super easy. There are many benefits of removing Query Strings. However, many websites ignore this simple tweak. That’s a wrong way of thinking as every small tweak can make your site SEO friendly.

By doing this, the user experience will also improve, giving your site a clear edge compared to other sites.

One last thing that you should remember is to use the speed test websites such as GTMetrix, Google PageSpeed, and Pingdom to check your work. Your page score should go up.

So, what do you think about plugins we shared? Which one are you going to choose? Or are you going to do it manually? Comment below and let us know.

Join Software Buyers & Sellers

Get top software information and best deals right on your inbox.

HubSpot CRM Sidebar
Popular on Begindot.
An all-in-one employee management HR... is a leading project management and CRM solution,...
Smartsheet is a modern project...
Salesforce is one of the...

Promo Box*

Popular EOR Solutions

EOR (Employer of Record) helps businesses hire global workforce and make human resource-related processes easier.