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.

Leave a Reply

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