Compress WordPress output and speed your blog’s load speed

October 21, 2009 at 9:54 am

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):

<?php
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.