So far I never worried about the page load speed of this blog. But so far I even thought WordPress would use gzip compression on it’s own. Like I said, so far. Today I realized that WordPress is not just doing exactly that.
For those who are lost in gzip, I’ll give a short explanation at first. Gzip is a compression method in order to minimize the size of a file. Today it is mostly used on Unix systems. In the website context, it is used to reduce the size of data which is transferred from the server to the user’s web browser. This not only reduces the traffic and, by implication, the overheads too, but also it brings a reduction of the website’s loading time with it.
To put it in a nutshell – how to get the gzip compression in WordPress enabled? Unfortunately there is no switch in the WordPress’ options page. So there remain two possibilities. On the on hand you could use a WordPress plugin like GZippy and on the other hand you could activate it manually. I personally prefer the second solution, because I don’t want to wait for a patch if the plugin breaks one day. In addition to that the installation of gzip is really fast done.
So let’s start. Log in to your WordPress-Backend and click on the “Editor” link in the left sidebar beneath the “Design” menu. Now open the functions.php file and add the following PHP direct below the opening PHP-tag (“<?php”).
That’s it. From now on your blog should be delivered with the help of gzip compression. If you would like to test if you’ve all things done right, you can test your blog or website with this website for example.