Search code examples
htmlwordpresscompressionminify

How to minify Wordpress output html code on single line?


i need to speed up my Wordpress blog. I searched around the web, but no success. I want to minify or compress my output html code on one(single) line, like Matt Cutt's blog. I tried W3TC, WP Minify and many others, but without result. I need script, plugin, function or something that works.

Thanks in advance.


Solution

  • This is really not the best way to speedup your site. If you do it in the template it make the files unreadable and hard to maintain for less than 1% speedup. If you do it with a plugin that process the output, it will slow down the render.

    Make sure :

    • You use as few plugins as possible, for example it's much faster to copy tracking code (google analytics or such) in footer.php than using a plugin
    • You have compiled, cleaned, minifyied CSS and JS that is on your server and properly compressed files.
    • You use CDN for all files that are on CDN like JQuery on https://developers.google.com/speed/libraries/devguide
    • Put mod_expire on your server and set expire date for media files far in future with .htaccess . This will prevent browsers from checking if files have changed (all the 200 status code you see in network traffic analysis)
    • Cache content using WP supercache or similar plugin
    • Install APC cache with enough memory (at least 32M for a single WP installation)