WP-Compress-HTML

This is the homepage of the WP-Compress-HTML plugin for WordPress.

WP-Compress-HTML

WP-Compress-HTML reduces HTML file size by removing unnecessary white space from the HTML document created by the WordPress blog.

What is WP-Compress-HTML all about?

Coders and template designers like to use spaces, carriage returns, new lines, tabs and indentation to make their HTML documents human-readable. This helps collaboration and debugging of the HTML document. However, all these features add to the filesize of the resultant HTML document. This structural information is totally ignored by browsers.

This plugin removes spaces, carriage returns, new lines and tabs from your HTML document. You can therefore freely use these features while writing HTML, safe in the knowledge that it will not bloat the final HTML document.

With this plugin you can also mark areas of your HTML template where you want to preserve white space – for example – in areas containing Javascript which needs carriage returns and new lines to function correctly.

HTML Comments are not affected by this plugin.

Installation instructions

  1. Download the WP-Compress-HTML plugin.
  2. Extract the wp_compress_html.php file and upload to the ‘/wp-content/plugins/’ directory.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. If there are areas which you do NOT want compression to be applied, simply enclose each area with a pair of < ––wp-compress-html––> tags. Use one at the beginning and one at the end of the area you want to protect. Drop in a < ––wp-compress-html no compression––> tag within each area marked in this way to tell the plugin that area is not to be compressed.

Frequently Asked Questions

  • Why do I need this plugin?

    When you are coding your HTML template, you will almost certainly want to add spaces, tabs and carriage returns to the document. This helps you to read it, but this information is ignored by the browser and transmitting it to the browser is a waste of bandwidth. It bloats your files and slows your site down. This plugin will remove all this unnecessary “white space”.

  • How much savings can be achieved with this plugin?

    We have seen savings of upto 5-10%, depending on how much “white space” is in your HTML templates. Even if this does not sound like much, it certainly adds up on a busy site with a high number of page views.

  • How do I mark areas that should not be compressed?

    WP-Compress-HTML screenshot showing how to mark areas that should not be compressed
    Look at this screenshot to see how to mark areas in your template that should not be compressed. Simply add the tags in red to wrap around areas that should not be compressed.

  • Does it work for WordPress version x.x.x?

    The plugin has been tested upto WordPress version 3.3.1.

36 thoughts on “WP-Compress-HTML

  1. Pingback: WP-Compress-HTML available « Mandar’s [Project 365]

  2. This seems a very useful plugin. However, I wonder a thing, it speeds up the download of the files, however while removing white space it uses CPU and won’t it slow down the creation of the page?
    If it creates the pages slower, even if it creates smaller files, we won’t earn many things. Is it a problem, will it effect CPU usage a lot.

  3. Hi Ferhad, you are right, the initial page generation will increase CPU usage a little bit.

    However, most web servers (including Apache) will cache the page after it is generated. It will do this automatically.

    Also, if you install a plugin such as WP Super Cache, it will also cache the page on the server.

    So once the page has been generated, the subsequent hits will not take any further CPU cycles.

  4. Thanks for the reply. I have been using it since I left the previous comment to test it. It’s great, before it all my theme pages were one line and hard to edit, after it everything is great. I don’t use a cache plugin but I haven’t noticed an important increase in my shared server’s CPU usage. That’s great, thanks. :D

  5. Please fix wp-compress to work well with All in One Seo Pack script, when I set custom Title with AIOSP in post your script removes them, I’m very thankful to you for this script it really saves around 10-15% of traffic and hope this gonna be fixed soon, take care!

  6. hi,
    thanks for this plugin :) i really like it:)

    i modified it a little so ALL code is cleaned (without need to use your stopcode).

    see it – i think you find out, what i’ve changed ;)

    best regards,
    thomas

  7. Hey, the plug in is not working for my WP 2.7.1 install… It returns the beginning of the , no close header tag, no body tags, and no close html tag… after all my css links all there is is two tags. Very strange! So my whole page appears to be missing when the plug in is activated. Let me know if you’d like to see the source! -Joe

  8. Hi there,

    I found a incompability bug between Viper’s Video Quicktags & WP-Compress-HTML.

    If WP-Compress-HTML is activated, videos aren’t showing up, just a link or a preview image.

    Any ideas?

  9. Hey, any news on a future update?

    A couple of feature requests:

    1. Auto-ignore <pre></pre> contents
    2. Strip out <!–comments–> from inside <html></html>

    I just read your response to my initial post and I’m set up to receive an email to your response. If you haven’t yet started on any updates, I can possibly add these in. But if you’ve made improvements, there’s no sense working with old code.

    Cheers

  10. hi

    Wp-Compress html doesn’t go well with ‘all in one seo ‘ , it removes the posts’ titles and replace them with the front page title….any cure ??

  11. Sorry, no cure as yet.

    You might want to try WP-HTML-Compression instead – follow the link above. It is more likely to work with “All in one SEO”.

  12. i tried both plugins, but, i got the same problem, & i’ve also used the tags you mentioned for non-compression, and it didn’t work out…have you another suggestion Mr Mandar, i would be thankful, if you help me to solve it, and it would be a good fixing for ur great plugin !!??

  13. Both plugins do not reference database entries, which would contain a different title. If you’re having an issue, the issue lies elsewhere; probably in “All in one SEO”.

  14. thx a lot dear steven and mandar, i’ll try out Platinum SEO Pack…talking about seo, i have a frensh content website, and i want it to appear in the first page of Google when someone tap the name of the city on which it belongs, now my website appear in 2nd page?? i used a lot methods, but i didn’t succeeded?? i know ur profesional?? what do you advice me to do ????

  15. That’s a tough one, especially if Wikipedia for example is the #1 result.

    All I can suggest is keep trying, get more high-quality links, build more content, submit sitemaps, target specific keywords etc. (Just the usual stuff eh…!)

  16. I’m just wondering, how well is this plugin working with the current version of WordPress? Since wordpress.org is saying it hasn’t been updated in over 1,000 days, I’ll wait for a response before I try it out.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>