Remove query strings from static resources for better SEO

Usually, you can hear people talking about the pretty URL when converting default URLs, such as /?p=1, to search engine friendly links, like /your-post-name/. That we can configure with permalinks in WordPress (and don’t worry, as our customers, we already configured that for you when we initiated the site). However, WordPress also adds version information into plugins after you installed. It can make your caching system not working as expected. So, for better performance, you should remove query strings from those resources, to make your site faster and better for SEO.

Remove query strings

How to remove query strings?

Before, I used this plugin. It did its job, to remove query strings from static resources, as its name. Unfortunately, for recent versions, it makes longer waiting time for processing, and it might end up making the site slower. I decided to remove that plugin from our recommended plugin list. Then what to do?

Pretty simple. I already introduced our core plugin. Now, we have added few more code lines into it, and it can remove query strings as expected. And doesn’t slow down the site. This code should be placed in function.php file if you are reading this, but not using our core plugin.

Ok, I added. What to do next?

Nothing, except disabling and deleting the old plugin. If you added my script into function.php file, it’s running whenever there is a request to your website. As for our customers, we have already updated our core plugin.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.