Unlock 30+ exclusive font downloads and join a growing community for only $1

SerifSans SerifScriptSymbolsSlabDisplayHandwrittenBlackletter

How to use GZip in a WP website

Home > Blog

Recently, I used again Page Speed from Google to see what more can I do to make Kreativ Font faster.

One of the points i found out was that I did NOT had GZip compression enabled. This was weird, since i was already using the GZip code on the header of my theme.

I found this cool tool to check if your website has GZip compression enable from WhatsMyIp

I knew that GZip compression works only if you have Apache’s “mod_gzip” module enable.

My hosting company, GoDaddy, said the mod_gzip module is already enabled for their Linux hosting. I email them anyway to let them know that is NOT working for me. The answer was very fast and they showed me that is works.

Then I figured it out!

To enable GZip compression in WordPress, you must put the code below in the fist line of index.php of your wp theme, NOT in the header.php:

<? php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>

Please let me know if you encounter issues …

Thank you!