How can I remove all comments from source code?
Whether for performance reasons (less lines of code) or confidentiality reasons (hiding commented lines or avoiding the flashy signature of a plugin), it is interesting to mask the comments of the source code of your pages (the HTML rendering, not the source code of your templates).
To do this, simply add this code to your functions.php file:
* Remove all comments in source code
$buffer = preg_replace(‘/<!–(.|s)*?–>/’, ”, $buffer);
The conditional CSS class like <!– [if lt IE 10]> won’t be removed.