Title: extended_valid_elements
Last modified: May 21, 2020

---

# extended_valid_elements

 *  [mahrr](https://wordpress.org/support/users/maloherry/)
 * (@maloherry)
 * [6 years ago](https://wordpress.org/support/topic/extended_valid_elements/)
 * Hello,
    Thanks for your plugin. I added two options:
 *     ```
       paste_preprocess | function(plugin, args){
           // Strip all HTML tags except those we have whitelisted
           var whitelist = 'p,strong,em,i,b,h2,h3,h4,h5,h6,ul,li,ol';
           var stripped = jQuery('<div>' + args.content + '</div>');
           var els = stripped.find('*').not(whitelist);
           for (var i = els.length - 1; i >= 0; i--) {
             var e = els[i];
             jQuery(e).replaceWith(e.innerHTML);
           }
           // Strip all class and id attributes
           stripped.find('*').removeAttr('id').removeAttr('class').removeAttr('align');
           // Return the clean HTML
           args.content = stripped.html();
         }
       ```
   
 * and `extended_valid_elements | strong/b,em/i`
 * These are to clean HTML code when pasting from Word. The first one seems to work(
   it removes not whitelisted tags, etc.) but the second one does not: I still have
   b and i tags in my editor, while I’d like them to be replaced by strong and em
   ones.
 * Thanks for your help.
    -  This topic was modified 6 years ago by [mahrr](https://wordpress.org/support/users/maloherry/).

The topic ‘extended_valid_elements’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/advanced-tinymce-configuration.svg)
 * [Advanced TinyMCE Configuration](https://wordpress.org/plugins/advanced-tinymce-configuration/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-tinymce-configuration/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-tinymce-configuration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-tinymce-configuration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-tinymce-configuration/reviews/)

## Tags

 * [tinymce](https://wordpress.org/support/topic-tag/tinymce/)

 * 0 replies
 * 1 participant
 * Last reply from: [mahrr](https://wordpress.org/support/users/maloherry/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/extended_valid_elements/)
 * Status: not resolved