Title: [Plugin: W3 Total Cache] Excluding code from minification
Last modified: August 19, 2016

---

# [Plugin: W3 Total Cache] Excluding code from minification

 *  [indole](https://wordpress.org/support/users/indole/)
 * (@indole)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/)
 * Is there any way to exclude some HTML from being minified, like through comments?
 * The pagination of the main slider on the [site](http://www.cognitivepolicyworks.com/)
   looses it’s spacing, become bunched up, and moves to the top of the midbar.
 * I think it is loosing a div or something and the CSS selector no longer applies.

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

 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624093)
 * if your HTML is valid, minification will not affect layout. Check the W3C validator:
   [http://validator.w3.org/](http://validator.w3.org/)
 * You can add define statements listed in the FAQ usage section if you want to 
   add a conditional statement to prevent a page from being minified.
 *  Thread Starter [indole](https://wordpress.org/support/users/indole/)
 * (@indole)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624144)
 * It’s valid under transitional and the errors I get while running strict have 
   nothing to do with that part of code.
 * It’s the homepage, so I might as well not turn on minification : )
 * I set up a mirror [here](http://cog.indolering.com/) if you want to take a look.
   [Email me](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/zachlym@indolering.com?output_format=md)
   and I can give you an admin login. It is **not** configured to do inline JS.
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624290)
 * Email sent.
 *  Thread Starter [indole](https://wordpress.org/support/users/indole/)
 * (@indole)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624441)
 * Any luck? I have had success with other minifiers- maybe you should just include
   multiple engines on the next release…
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624443)
 * I’m not able to duplicate the issue. What minify engines would you suggest?
 *  [Nic Windley](https://wordpress.org/support/users/nisiwi/)
 * (@nisiwi)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624444)
 * I had a similar problem and found that it was due to some comment that had not
   been closed correctly.
 * I had a piece of JS which started with the following comment;
 * <!– comment
 * There was no closed bracket so the HTML minification messed up so it might be
   worth double checking your code to ensure there are some –> closing all comments.
 *  [Nic Windley](https://wordpress.org/support/users/nisiwi/)
 * (@nisiwi)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624445)
 * sorry I meant use // for comments instead
 *  [Nic Windley](https://wordpress.org/support/users/nisiwi/)
 * (@nisiwi)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624447)
 * strange for some JS its still killing the code. For example
 * This code – works
 * `<a href='//www.voipfone.co.uk/callmeback.php?code=8e52c3e26f38f90a", 350, 400,"",
   20, 20)'><img src="https://www.voipfone.co.uk/images/call-me-back.jpg" width="
   120" height="60" border="0" align="absmiddle"></a>`
 * Becomes (when HTML minification is active) – and fails
 * <a
    href=’JavaScript:openPopWin(“[http://www.voipfone.co.uk/callmeback.php?code=8e52c3e26f38f90a&#8221](http://www.voipfone.co.uk/callmeback.php?code=8e52c3e26f38f90a&#8221);,
   350, 400, “”, 20, 20)’><img src=”[https://www.voipfone.co.uk/images/call-me-back.jpg&#8221](https://www.voipfone.co.uk/images/call-me-back.jpg&#8221);
   width=”120″ height=”60″ border=”0″ align=”absmiddle”>
 * Looks like the space between the <a and the href= have been removed and seperated
   onto different lines
 *  [Nic Windley](https://wordpress.org/support/users/nisiwi/)
 * (@nisiwi)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624448)
 * OK, I solved this by avoiding any JS or CSS comment / line removal so when I 
   activated HTML minification (again avoiding comment and line removal) everything
   worked.
 * Excellent!
 *  Plugin Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624464)
 * Great.

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

The topic ‘[Plugin: W3 Total Cache] Excluding code from minification’ is closed 
to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 10 replies
 * 3 participants
 * Last reply from: [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-w3-total-cache-excluding-code-from-minification/#post-1624464)
 * Status: not resolved