Hello,
Does the issue occur only when Minify is active? DO you have any other caching solution installed?
The problem occurs only when minify is active. We also have Redis cache enabled.
Hello,
Is minify enabled on Auto or Manual? Also, does the issue persists if you disable HTML minify in Performance>Minify?
Hi Marko,
Minify is enabled in Auto, tested in manual mode no change.
Disabled minify in Performance > Minify and the problem does not happen anymore.
But we really need html minify active as it increases a lot the performance in the client side.
Marko,
I’ve been debugging here and found something:
In the file wp-content/plugins/w3-total-cache/lib/Minify/Minify/HTML.php
If I revert theses lines (140 up to 151) from version 0.9.7.4:
// remove ws around block/undisplayed elements
$this->_html = preg_replace('/\\s+(<\\/?(?:area|article|aside|base(?:font)?|blockquote|body'
.'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
.'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
.'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)'
.'|ul|video)\\b[^>]*>)/iu', '$1', $this->_html);
// remove whitespaces outside of all elements
$this->_html = preg_replace(
'/>((\\s)(?:\\s*))?([^<]+?)((\\s)(?:\\s*))?</u'
,'>$2$3$5<'
,$this->_html);
to the version 0.9.7.2:
// remove ws around block/undisplayed elements
$this->_html = preg_replace('/\\s+(<\\/?(?:area|base(?:font)?|blockquote|body'
.'|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|form'
.'|frame(?:set)?|h[1-6]|head|hr|html|legend|li|link|map|menu|meta'
.'|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h||r|foot|itle)'
.'|ul)\\b[^>]*>)/i', '$1', $this->_html);
// remove whitespaces outside of all elements
$this->_html = preg_replace(
'/(^|>)\\s+\\b([^<]+)\\b\\s+?(<|$)/'
,'$1 $2 $3'
,$this->_html);
The HTML minify works after this revert.
Hello,
This is a valid issue. We’ve added an issue for this and it will be fixed in the future release.
Thank you for bringing this to our attention and thank you for your patience.
Hello Marko,
Dropping here to tell you the fix you included in 0.9.7.5 works fine for us now, we can finally update w3tc
Thanks!
Hello @edemir206,
Glad to know the issue is resolved!
Marko,
Sorry for dropping here again, but we found that some of our pages are still facing problems with minify. The problem is the same above and switch back to the version 0.9.7.2 fixes the problem 🙁