WordPress.org

Ready to get started?Download WordPress

Plugin Directory

WP-HTML-Compression

Reduce file size by shortening URLs and safely removing all standard comments and unnecessary whitespace from an HTML document.

Will this plugin slow down my page load times?

Yes, slightly. While you should be using WP Super Cache anyway, it will correct the issue.

Will Internet Explorer conditional comments be removed?

No.

Is this plugin HTML5-compatible?

Yes.

Will having invalid HTML cause an issue?

Probably, however WordPress does a pretty good job of correcting invalid markup. But honestly, it's your job to make sure that your code doesn't suck.

Will this plugin interfere with my hash-based JavaScript navigation?

If the links in your HTML are not hard-coded as hashes without the use of a script, an issue could occur with URL shortening. If so, setting $shorten_urls on line 21 of libs/html-minify.php to false will fix that.

My URLs have the "http:" and/or "https:" stripped??

This is totally fine and actually intentional. It's standard and will not cause 404s nor get in the way of your SEO, but it will lower file size! You might be interested in reading more about this technique, called scheme-relative URLs.

Why does my compressed HTML have a space between most tags?

To preserve rendered whitespace. One or more line breaks in your markup are rendered as a single space in a web browser. Visual discrepancies would occur if those line breaks were not converted to at least one space.

How do I mark areas that should not be compressed?

While <pre>, <textarea> and <script> tags are automatically left uncompressed, you can designate any code to be exempted from compression. Simply drop your content between a pair of <!--wp-html-compression no compression--> comment tags. A picture is worth a thousand words; so, check the screenshots.

How do I compress the contents of <script> tags?

Until a settings page is created, you'll have to edit the file from the "Plugins" menu in the WordPress admin. Set $compress_js on line 21 of libs/html-minify.php to true. This is not recommended as this plugin is not yet ready to properly compress inline scripts.

Are you or have you thought of using HTML Tidy?

Since not every WordPress server supports the installation of PHP extensions, this plugin does not currently make use of HTML Tidy. However, future releases may do so.

Will this plugin work for WordPress version x.x.x?

This plugin has only been tested with versions of WordPress as early as 3.2. For anything older, you'll have to see for yourself.

Requires: 3.2 or higher
Compatible up to: 3.5.2
Last Updated: 2013-3-20
Downloads: 68,009

Ratings

3 stars
3.6 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1
0,1,0 100,1,1 100,1,1
0,1,0 100,1,1 50,2,1
0,1,0 100,1,1 100,1,1
50,2,1
50,2,1
50,2,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
50,2,1
100,1,1
100,2,2
75,4,3
100,3,3
0,1,0 40,10,4
50,4,2
67,3,2 75,4,3 100,3,3
100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1