I had a page in WordPress with 100+ empty <a>
tags (i.e. links with no content) which were polluting the HTML (and causing the block editor to complain).
Rather than manually go through and remove each one in the code editor view of the page, I pasted everything from the code editor into Sublime Text and then did a regex search and replace with:
<a href=".*?"><\/a>
And then:
<a rel=".*?" href=".*?"><\/a>
There’s probably an even cleaner way to do it, but that already saved me a lot of time.
Leave a Reply