Skip to main content

A function to remove unwanted HTML comments.

// Remove unwanted HTML comments
function remove_html_comments($content = '') {
  return preg_replace('/<!--(.|\s)*?-->/', '', $content);
}