678-807-9676 hi@yazminmedia.com

remove-query-strings-from-static-resources

 

Continuing from the earlier blog posts, we’re looking at how to speed up our WordPress installations. This week, I’m going to show you how to remove query strings from static resources to improve your page load speed.

 

What happens when you remove query strings from static resources?

Because there are updates to CSS and jQuery files all the time to add new improvements, sometimes, website features don’t work with the newly release versions. Which leads us to linking these files with query parameters to mark which version works for the website features.

The problem is this… since these links have query parameters, they aren’t cached by some proxy caching servers to improve the page load speed of a website.

 

How to remove query strings from static resources

Removing query strings from static resources is a simple addition of code. Since we want to measure our improvement with the following change, I’ve created a test website and have run it through the GTMetrix tool to get a before and after benchmark for our changes.

This is the current score for the test website:

remove-query-strings-from-static-resources-before

Now let’s move on to the changes…

Step 1: Create a site-specific plugin. If you need some help with this, here is a tutorial on how to create a site-specific plugin.

Step 2: Add the following code to your site-specific plugin.

And that’s it!

Here’s the score from my test website, after adding the code to remove query strings from static resources:

remove-query-strings-from-static-resources-after

If you look at the grade scores, they pretty much stayed the same, but adding the code for reduced the page load time by 1 whole second. Woot!

So, did this work for you? What improvements did you see in your page load time?