Title: WordPress Visual Editor Stripping HTML Changes
Last modified: August 21, 2016

---

# WordPress Visual Editor Stripping HTML Changes

 *  [mcography](https://wordpress.org/support/users/mcography/)
 * (@mcography)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wordpress-visual-editor-stripping-html-changes/)
 * When I use the WordPress HTML editor to add icomoon icons like this
 * `<span class="icon-shield"></span>`
 * and then switch to the visual editor and then back to the HTML editor, the icons
   disappear. I am trying to include [this bit of Javascript](http://www.tinymce.com/wiki.php/configuration:extended_valid_elements)
   to fix this. I looked at wp_enqueue_scripts and put this in functions.php, but
   it still doesn’t fix the problem.
 *     ```
       function oakwood_tinymcefix() {
           wp_enqueue_script( 'tiny_mce' );
           echo '<script type="text/javascript">'
          , 'tinymce.init({
                   ...
                   extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]"
               });'
          , '</script>';
       }
       add_action( 'admin_enqueue_scripts', 'oakwood_tinymcefix' );
       ```
   
 * How can I fix this?

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wordpress-visual-editor-stripping-html-changes/#post-4971619)
 * Don’t switch editing tabs. That’s the fastest way to remove some (or all) of 
   your markup due to the way in which the TinyMCE visual editor works. Use the 
   Text tab for this Post or Page and then stick to it.
 *  Thread Starter [mcography](https://wordpress.org/support/users/mcography/)
 * (@mcography)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wordpress-visual-editor-stripping-html-changes/#post-4971622)
 * This is a problem on every post. Unfortunately, I’m building this site for a 
   client who doesn’t know HTML that well. They’ll want to use the visual editor.
   I can’t tell them to just use the HTML editor. Kind of defeats the purpose of
   WordPress as a content-editor-friendly CMS, doesn’t it? Isn’t there a way to 
   fix this?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wordpress-visual-editor-stripping-html-changes/#post-4971638)
 * > Isn’t there a way to fix this?
 * Not the tab switching issue, no. Perhaps you need to approach this from another
   direction? Especially if you are adding lots of markup to Posts and/or Pages.
 *  Thread Starter [mcography](https://wordpress.org/support/users/mcography/)
 * (@mcography)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/wordpress-visual-editor-stripping-html-changes/#post-4971642)
 * That’s disappointing. What’s the point in being able to switch tabs then?

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

The topic ‘WordPress Visual Editor Stripping HTML Changes’ is closed to new replies.

## Tags

 * [editor](https://wordpress.org/support/topic-tag/editor/)
 * [html editor](https://wordpress.org/support/topic-tag/html-editor/)
 * [icomoon](https://wordpress.org/support/topic-tag/icomoon/)
 * [icons](https://wordpress.org/support/topic-tag/icons/)
 * [tinymce](https://wordpress.org/support/topic-tag/tinymce/)
 * [visual editor](https://wordpress.org/support/topic-tag/visual-editor/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [mcography](https://wordpress.org/support/users/mcography/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/wordpress-visual-editor-stripping-html-changes/#post-4971642)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
