Title: Minify HTML error
Last modified: January 8, 2018

---

# Minify HTML error

 *  Resolved [frizzel](https://wordpress.org/support/users/frizzel/)
 * (@frizzel)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/)
 * When I enable HTML Minify Firefox tells me “Stray end tag ‘head'” and “‘body’
   start tag seen, but element of the same type was already open”.
 * I don’t see anything strange in the minified HTML, but when I disable minifying,
   the errors are gone. I tried disabling JavaScript and CSS handling and only keep
   HTML minifying: no change. I tried “Alternative HTML Minifying”, but that seems
   to do no minifying at all.
 * In the end I enabled Javascript and CSS handlers in this plug-in and use a separate
   plug-in for html (‘Minify HTML’) and then: NO errors.
 * So, I think something goes wrong in the minifying of HTML with this plug-in. 
   The question is, what exactly.
    -  This topic was modified 8 years, 5 months ago by [frizzel](https://wordpress.org/support/users/frizzel/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Raul P.](https://wordpress.org/support/users/alignak/)
 * (@alignak)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/#post-9843448)
 * When you disable html minification, does your site validate on [https://validator.w3.org/](https://validator.w3.org/)?
 * It looks like you’re missing some html tag or not closing one.
    Our plugin uses
   mrclay minify [https://github.com/mrclay/minify](https://github.com/mrclay/minify)
   for this. The alternative version only removes extra linebreaks and spaces, it
   works if your theme is not optimized.
 * The html minify plugin probably uses something else.
 * You’re the first person ever to report problems with this feature, and I know
   it works perfectly on thousands of sites, having tested it with over 100 themes
   myself.
 * That being said, I’m always looking at ways of improving things.
 * If you can validate the site on w3.org and there are no missing or closing tags,
   then I’ll look into porting the library on html minify to my plugin.
 *  Thread Starter [frizzel](https://wordpress.org/support/users/frizzel/)
 * (@frizzel)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/#post-9843492)
 * It’s on a local install at the moment.
 * However, I noticed a difference between the 2 methods.
    When your plug-in does
   the minifying there’s a line (without any tags): ob_start_detected That comes
   from All-In-One SEO Pack:
 *     ```
       if ( $this->ob_start_detected ) {
       			echo 'ob_start_detected ';
       		}
       ```
   
 * When I just make that echo line empty, there are no errors in the minifying.
   
   I’m now only puzzled why your plug-in triggers this, and the other doesn’t.
 *  Thread Starter [frizzel](https://wordpress.org/support/users/frizzel/)
 * (@frizzel)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/#post-9843686)
 * I see that you are using ob_start in the HTML Minify function which triggers 
   AIO SEO to echo that line.
 * It’s probably more for their support forum, but FYI: it only happens when ‘Force
   Rewrite’ in AIO SEO is set to ‘on’ (using output buffering).
    However, I don’t
   understand why they need to print that line as without it, it works just as well
   as far as I can see.
    -  This reply was modified 8 years, 5 months ago by [frizzel](https://wordpress.org/support/users/frizzel/).
 *  Thread Starter [frizzel](https://wordpress.org/support/users/frizzel/)
 * (@frizzel)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/#post-9844343)
 * FYI, I’ve opened a topic on AIO SEO support, too: it’s [here](https://wordpress.org/support/topic/ob_start-and-html-minifying-error/)
 *  Plugin Author [Raul P.](https://wordpress.org/support/users/alignak/)
 * (@alignak)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/#post-9844529)
 * Thanks for letting me know about this.
 * I use the AIO SEO in a couple of sites and never used the Force Rewrite option,
   so I didn’t know.
 * I think that line of code is some sort of debug option for their developers, 
   but they didn’t expect other plugins to use this function on the same hook and
   level.
 * I also don’t understand why it needs to be there, so thank you for opening the
   topic on their forum.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Minify HTML error’ is closed to new replies.

 * ![](https://ps.w.org/fast-velocity-minify/assets/icon-128x128.jpg?rev=1440946)
 * [Fast Velocity Minify](https://wordpress.org/plugins/fast-velocity-minify/)
 * [Support Threads](https://wordpress.org/support/plugin/fast-velocity-minify/)
 * [Active Topics](https://wordpress.org/support/plugin/fast-velocity-minify/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fast-velocity-minify/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fast-velocity-minify/reviews/)

## Tags

 * [html](https://wordpress.org/support/topic-tag/html/)
 * [minifying](https://wordpress.org/support/topic-tag/minifying/)

 * 5 replies
 * 2 participants
 * Last reply from: [Raul P.](https://wordpress.org/support/users/alignak/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/minfy-html-error/#post-9844529)
 * Status: resolved