preloader

Why WP HTML Compression Removes Important HTML Comments

You enable WP HTML Compression. Site is faster. But Internet Explorer support breaks. Conditional comments for IE are gone. That is frustrating because some users still use old browsers.

A common issue is that the plugin removes all HTML comments by default. This includes conditional comments for Internet Explorer. The plugin is not broken. You need to preserve important comments.

Why WP HTML Compression Removes Comments

HTML comments are not visible to users. Removing them reduces file size. WP HTML Compression removes comments by default. But some comments have functional purposes: IE conditional comments, Google Analytics code comments, or plugin markers. Removing them breaks functionality.

This is not WP HTML Compression being bad. Comment removal is optional. You can disable it.

The Most Common Comment Removal Breakages

  • Internet Explorer conditional comments (IE-only CSS/JS)
  • Google Analytics or Tag Manager code comments
  • Plugin inline comments (markers for dynamic content)
  • HTML5 shiv or polyfill comments
  • Developer notes that are parsed by scripts

Check if your site uses functional comments.

How to Fix WP HTML Compression Comment Removal

  1. Go to WP HTML Compression → Settings
  2. Disable “Remove HTML comments” option
  3. Save settings
  4. Clear cache
  5. Test Internet Explorer or affected functionality

Disabling comment removal fixes the issue.

Alternative: Keep Comments but Minify Everything Else

You can keep comments while still minifying HTML. Disable comment removal only. Keep whitespace removal, attribute minification, and other optimizations. Site still gets speed benefits.

Comments add minimal file size. Removing them saves very little. Keep them for compatibility.

Which Comments Are Safe to Remove

Safe: WordPress generator tags, theme author comments, developer notes, conditional comments not in use.

Unsafe: IE conditional comments, script markers,