DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

WordPress, by default, comes uncompressed and sends the uncompressed HTML to the visitor’s browser. With one line of code added to your header, you can compress WordPress’s output by up to 75%. By using zlib compression technology, you can harness the power of PHP and reduce your blog’s load speed!

First, place the following code in a file and call it “test.php” and then upload it to the root of your blog directory:

<?php phpinfo(); ?>

Make sure that “zlib” is enabled by your hosting provider.

Second, place the following code in your header (above the DOCTYPE):

ini_set('zlib.output_compression', 'On');
ini_set('zlib.output_compression_level', '1');

You’re done! Check Port80Software.com to ensure you are compressing your output.

22/10/2009 update : If you’re interested in WordPress themes designed for small businesses, you should definitely have a look to the list I have compiled over at cats Who Blog!

Thanks to Brad Ney for hios contribution to WpRecipes! Brad is the author of BradBlogging.com, which is all about WordPress, HTML & CSS and Usability tips and tweaks. You can subscribe to his RSS Feed here.


  1. Place in what file? Its pretty poorly described

  2. after apply this metod, i got this :

    This page contains the following errors:

    error on line 5 at column 6: XML declaration allowed only at the start of the document
    Below is a rendering of the page up to the first error.

    on my feed.

  3. Is there any plugin for Compress the theme ?

  4. Wow, I know this post is old but what a find!

    Original size: 27894 bytes
    Compressed size: 7714 bytes
    Savings in bytes: 20180 bytes
    Percentage saved by compression: 73.0%
    Transfer speed improvement: 3.6 X

    And you automatically see the difference, thanks a lot.



Leave a Comment

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