Strip from the_tags() output

Well, you can use the DOM object to change/remove tags and their parameters. See here for all the details https://stackoverflow.com/questions/3820666/grabbing-the-href-attribute-of-an-a-element

Code would be something like this: (this sample changes the class of all H1 elements to be ‘a_new_class’, removing any existing classes)

$html = "<h1 class="the_old_class">A Heading</h1>";
$dom = new DOMDocument;
libxml_use_internal_errors(false); // supress errors
$dom->loadHTML($html, LIBXML_NOERROR);  // supress errors
foreach ($dom->getElementsByTagName('h1') as $node) {
    $node->setattribute('class','a_new_class');         
    $dom->saveHtml($node) ;
}
$html = $dom->saveHTML();   // saves the object (all of the html) so we can return it

Although the other answer works; I add this to show an alternative method of changing elements that doesn’t rely on regex trickery.

tech