My first post, please forgive me if I'm doing it wrong.

For some reason when switching to the visual editor WordPress will strip out my a tags. "Don't use the visual editor" isn't an option, I'm making a website for clients and I'm trying to make it foolproof. I don't want them to be able to go to the visual editor and accidentally have all the links stripped out.

This is a sample of the code. When switching to visual and back to text, everything is there but the a tags.

<a href="https://www.url.ca" target="_blank" title="Donate Now">
<div class="donate-now">
<div class="wred">
<h1>Click here to Donate Now</h1>
<div class="wbumpred"> </div>

class="wred" styles a background colour and shape.
class="wbumpred" adds a small graphic element to the bottom of the "wred" element.

Please help!


  • I'm not sure why the Block editor wouldn't "allow" this markup, that's why I decided to write my suggestion as a comment. If I had to do something similar I would have used the Button or the Custom html blocks. The Button block's markup is anchor in a div, both can have :after and :before pseudo-elements for the graphics and the styles; you can add custom class to the wrapping div via Edit as HTML. The other option is straightforward and "allows" any HTML code; you can toggle the Preview tab so the markup doesn't scare the end users. Cheers! Aug 19, 2019 at 21:36
  • Are you talking about the Block Editor or the Classic Editor?
    – WebElaine
    Aug 19, 2019 at 21:54
  • @ValentinGenev, I'm not sure how to reply to your comment without creating a new comment. I should have clarified, I'm using the classic Visual Editor and Text Editor, I've disabled the new Block Editor. I don't want to have to teach clients how to use the block editor when I can teach them to use the classic visual editor as a very basic version of MS Word when they'll mostly just be modifying text and images. Also, I've tried using block editors before, I really really really don't like them! lol :) Aug 19, 2019 at 22:03
  • @WebElaine, the Classic Editor, I totally forgot about the new Block Editor, I have it disabled. Aug 19, 2019 at 22:06
  • @SarahMorrow Take a look at this, it should answer your question TinyMCE editor is breaking my beautiful HTML. Aug 20, 2019 at 8:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.