How To Remove Query Strings Script Version From Static Resources

What is Query Strings?

According to Wikipedia,  a query string is the part of a uniform resource locator (URL) that contains data to be passed to web applications such as CGI programs. see here in Wikipedia for more details about Query Strings. It is look like this:

http://www.howtotips24.com/wp-content/plugins/js/some_js?ver=3.4.2

Why Need to remove them?

Mostly two importance that removing them will benefit your website.

Most proxies including content delivery networks, most notably Squid up through version 3.0, do not cache resources with a “?” in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for these resources, remove query strings from references to static resources, and instead encode the parameters into the file names themselves.

On the other hand, It will give away your WordPress version. If you are running a old version of WordPress then it will be vulnerable to attack.

I was looking through Pingdom, Google Page Speed, GT Metrix to check my page speed. I found this suggestion to remove Query Strings Script Version From Static Resources. I searched Google and find this code in http://diywpblog.com. Thanks to Matthew Horne.

How To Remove Script Version:

You need to edit the functions.php of your theme file. If you are using Thesis you will need to edit custom_functions.php. Be cautious while editing the functions.php. A slight mistake will make your blog unavailable. Better is edit through FTP or Cpanel.

How To Remove Query Strings Script Version From Static Resources

Copy and paste this code inside your functions.php. Add the code inside the PHP tage of your functions.php file.

Thats it, Thanks.

Check Also

How To Add Floating Social Share Buttons In Blogspot WordPress Site

Social media is one of the best way to earn more visitor to your site …

2 comments

  1. use the code in syntax highlighter, or using “code”

  2. rel=”external nofollow” in every outband link, Cool huh?

Leave a Reply

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

*