Title: HTML editor which doesn&#8217;t trash hand-coded HTML?
Last modified: October 4, 2022

---

# HTML editor which doesn’t trash hand-coded HTML?

 *  [QF0](https://wordpress.org/support/users/qf0wp/)
 * (@qf0wp)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/html-editor-which-doesnt-trash-hand-coded-html/)
 * I’ve been putting up with this for years, but it’s just getting to be too much
   trouble. I’m on 6.0.1. If I select a page, and select the Code Editor, and make
   a trivial change, it can modify the HTML, and make the page useless. And it’s
   not recoverable unless you can remember exactly what you wrote before, or you
   go back to a backup database.
 * On the current page I’m editing, a trivial text change deletes _all_ the hand-
   coded `span` tags on the page, and changes _all_ occurrences of `<li><a id="foo"
   >text</a></li>` to `<li><a id="foo"></a>text</li>`; this has lost all the links
   and changed the colours.
 * I’m on Gutenberg at the moment. I’ve tried to fix this historically (pre-WP6)
   by installing the Classic editor, but it made no difference.
 * Any ideas? Thanks.
    -  This topic was modified 3 years, 8 months ago by [QF0](https://wordpress.org/support/users/qf0wp/).
    -  This topic was modified 3 years, 8 months ago by [QF0](https://wordpress.org/support/users/qf0wp/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [George Appiah](https://wordpress.org/support/users/gappiah/)
 * (@gappiah)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/html-editor-which-doesnt-trash-hand-coded-html/#post-16069103)
 * It seems this is happing because you’re switching between **“Code Editor”** and**“
   Visual Editor”** modes. Most systems will find it hard to maintain 100% code 
   fidelity when switching between modes like this.
 * I’m wondering, does using the **CUSTOM HTML BLOCK** not suffice for your needs?
   That should avoid the problem you’re encountering altogether.
 * I’m also wondering… are you using empty hyperlink code like `<a id="foo">text
   </a>` to be able to create HTML anchor points? The block editor has a way to 
   do this visually, no need to write custom HTML with an `id` like this to create
   anchors.
 *  Thread Starter [QF0](https://wordpress.org/support/users/qf0wp/)
 * (@qf0wp)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/html-editor-which-doesnt-trash-hand-coded-html/#post-16070843)
 * On this site, when one of these links is clicked, another part of the CSS grid
   on the same page is filled with relevant content. There’s CSS and JavaScript 
   that handles the links, that highlights and increases the font size when hovering,
   that loads the new content, and so on, so it’s not really a traditional ‘link’.
   The CSS and JS does all this by matching on `id`. Maybe there’s a plugin that
   does all this, but I can never find a usable, supported, and high quality plugin
   when I need one, and it’s not a big deal to write the CSS and JS (no php required).
   However, it does rely on WordPress not messing with the HTML.
 * Never tried the ‘Custom HTML block’ thing. But if the problem is happening when
   the visual editor starts up, as you’re suggesting (and it sounds very plausible)
   I suspect this wouldn’t make any difference. It looks to me like it “checks” 
   the page on startup, removes whitespace, and “fixes” the HTML without either 
   understanding HTML or understanding that it might be there for a reason. Even
   something as simple as WS can be important – I put in lots of WS to line up tags
   in a long list, and something just removes it.
 * Looks like I’ll have to live with it for the next 10 years as well.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘HTML editor which doesn’t trash hand-coded HTML?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [QF0](https://wordpress.org/support/users/qf0wp/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/html-editor-which-doesnt-trash-hand-coded-html/#post-16070843)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
