How to strip old classes and spans
-
I and others have been updating the website of a magazine to the Gutenberg era, converting a bunch of old “Classic block” content to blocks. After this had been done quickly for many posts, I’ve now discovered that there is inline stuff that is getting in the way of things working properly, especially in headings. Is there a way to strip classes and span tags without editing the HTML manually for every block?
For example, here is what a typical heading looks like:
<h4 class="p3"><span class="s1">The path to Japan</span></h4>
The class on the heading tag is harmless, but the<span>
is preventing the heading from being the color specified for headings in my CSS. I can see in the visual editor that there is some sort of inline tag (span, em, strong, etc.) by the gray background when I put my cursor in it, but I can’t remove the span without selecting Edit as HTML, manually removing the pair of tags, and then selecting Edit Visually. Every heading is like this, so that’s a lot of work!In fact, ALL the blocks (including paragraphs) have a class on them – “p1”, “p2”, etc. I don’t know where that stuff came from, but it has nothing to do with our current theme and CSS. As I said, it’s harmless, but I’d love to see it disappear.
- The topic ‘How to strip old classes and spans’ is closed to new replies.