Quickly Remove Query Strings From Static Resources In WordPress

Quickly Remove Query Strings From Static Resources In WordPress

URL’s having a special character like “?”, “&” are not cached by proxy caching servers.

When you test your website to check the speed and load time of your website using the popular tools such as Gtmetrix, Pingdom and Google Page Speed, most of you get a low score in “Remove Query Strings from Static Resources”. URLs which contain special characters such as question marks (? ) And ampersand (&) are treated as Query Strings. You can’t cache a link with special character in its URL. It looks like :

/wp-content/themes/theme-name/css/style.css?ver=4.4.2

Faster websites get more users, readers and buyers as compared to normal websites.

These days every user and reader want fast loading web experience. Otherwise, they will go to one of your competitor’s sites that will load quickly.

Now, the main question is how to remove query strings from static resources without affecting the loading time of your website.

There are two different options for you, either choose to edit your theme’s function.php file in your themes folder or you can install a plugin for the same.

  1. Using functions.php: You just need to add the below code in your themes functions.php file. That code will remove the Query string from all of URL resulting good score in different website speed checking tools.



2. Using plugin:
You can just install the plugin “Remove Query String From Static Resources” and you are done.

Share

Comments

  1. hello Mr. Harish do you think plugin is easier than code please tell me

    example https://wordpress.org/plugins/remove-query-strings-littlebizzy/

  2. Yes, you can use plugin. Its easy to use. But it just increase the number of plugins, if we are using plugin for every small thing.

  3. So far it is helping! Thank you!
    Any idea how to optimize MailChimp’s embedded Signup forms?

  4. Thanks would be great if you could provide the code in txt rather than an image. Less likely to make mistakes 🙂

    Was a great fix though.

    Cheers

  5. can i remove the query strings from static resources with this plugin?
    wp super cache

  6. hello. I am a super low level beginner to websites. I am just doing mine to save some thousands of dollars. i found this problem after running a GT Metrix test. I see a lot of people recommending to install this coding rather than a plugin. I would like to know how i can do this. Where do I go, what option to click and after what text is that this coding has to be pasted.

    I have a total of 17 plugins installed. Dont really know how much is too much. Please help

Leave a Reply

Your email address will not be published. Required fields are marked *