Title: Editor strips some code
Last modified: December 16, 2016

---

# Editor strips some code

 *  [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/)
 * Hello,
 * I’m pulling my hair on a problem that I’m having with the editor for a while:
   it strips certain code, like the “input” fields from forms. By that I mean that
   I can enter all HTML code, but as soon as I save the post (as a draft), certain
   elements of the code are removed. WordPress even “notices” that something isn’t
   right and offers to restore the backup from the browser – which is just as incomplete
   then…
 * I’ve found a number of forum posts on sites like StackExchange and discussions
   in blogs, but nothing with a solution.
 * I’m logged in with my account and that account has admin rights, so that’s not
   the problem. I even created a new admin account and tried, to no avail.
 * I disabled all plugins that potentially mess with the editor, but no success.
 * I’ve tried a different theme in case it’s the editor styling or something.
 * I’ve disabled JetPack’s Proof Reading feature just in case, but that’s not it
   either.
 * And now I’m out of ideas, and would appreciate any help.
 * Thanks
    Alexander

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

 *  [MarkRH](https://wordpress.org/support/users/markrh/)
 * (@markrh)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8558737)
 * Does it strip out the items if you disable the Visual Editor in your profile 
   before adding the items? I have to do this sometimes when I want to add code 
   examples to a post.
 *  [Pioneer Web Design](https://wordpress.org/support/users/swansonphotos/)
 * (@swansonphotos)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8558745)
 * Your theme is using some default core functions, or may be hooking into them,
   to sanitize the HTML used in the Editor (for sanity). It strips out items like`
   <script>` or non html entities, etc.
 * The proper way to include in a page or post custom code is to create a [custom page template](https://developer.wordpress.org/themes/template-files-section/page-templates/#Custom_Page_Template).
 * I use them all the time for such and it works like a charm.
 * The basic Editor is basic. Page Templates are powerful. Review the Loop and the_content,
   and you will be on your way to making your WordPress site well advanced.
 * [https://codex.wordpress.org/](https://codex.wordpress.org/)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8558865)
 * What different theme did you try? When trying to eliminate potential conflicts
   you should use one of the default twenty* themes.
 * In a completely default installation, administrators and any users with unfiltered_html
   capability should have no problem entering form and input tags and even script
   tags. Like Pioneer Web Design indicated, themes and plugins can alter this behavior.
   That’s why it’s important to test with a theme known to not do this.
 * It’s possible some time in the past the unfiltered_html capability for administrators
   was removed on your site. This state will persist until explicitly changed because
   the state is saved in the options table. Changing themes and plugins will not
   typically change this. Some custom code can restore this state, but many find
   it easier to use one of the several role and capability management plugins. Once
   the capability is restored you can remove the plugin if you like since the change
   is saved in options.
 * Regardless of the unfiltered_html state, I’m with Pioneer Web Design in recommending
   page templates as a good alternative to directly entering potentially dangerous
   code into page or post content through the editor. Another way to enter such 
   content is via the [Shortcode API](https://codex.wordpress.org/Shortcode_API).
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8570742)
 * Hello [@markrh](https://wordpress.org/support/users/markrh/), thanks, that’s 
   interesting, I’ll try that – I add the code in the HTML/text only editor though,
   not in the Visual Editor.
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8570746)
 * Thank you [@bcworkz](https://wordpress.org/support/users/bcworkz/) – I tried 
   the latest 2017 theme, so it doesn’t seem to be theme related. I’m beginning 
   to suspect it was a security plugin (SecuPress) that I’ve been trying, but ended
   up uninstalling. I cannot be sure of course. Is there a particular plugin for
   the roles management you would recommend?
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8570752)
 * Thank you [@swansonphotos](https://wordpress.org/support/users/swansonphotos/)–
   that sounds like it is beyond my capabilities.
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8570792)
 * I found a plugin “Capabilities Manager Enhanced” and installed it. The “Administrator”
   role does have the “unfiltered_html” capability. I compared the capabilities 
   to another site where I don’t have that problem and they’re identical.
 * I disabled the Visual Editor in my user profile, but that doesn’t change anything
   either. Fields like <input> still get filtered.
 * What else can I do? Thanks for any ideas.
 * Alexander.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8570983)
 * You could try using a custom form plugin to add input fields to a post. One popular
   plugin is [Contact Form 7](https://wordpress.org/plugins/contact-form-7/). It
   emails form submits to someone by default, but other plugins are available to
   do something else with the data, like save it to the DB. It’s for more than contact
   forms. Any sort of form with fields can be created. The plugin ends up generating
   a shortcode to place in the post, so it’s like using the Shortcode API I previously
   referred to.
 * If you’ve removed all plugins and are using twentyseventeen and cannot enter 
   input fields, it’s probably time to do a manual re-install. Something has been
   corrupted. It’s like a [manual update](https://codex.wordpress.org/Updating_WordPress#Manual_Update)
   except you use the same version download as already installed.
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8573643)
 * Thanks [@bcworkz](https://wordpress.org/support/users/bcworkz/) – would the manual
   reinstall be the same as using Dashboard -> Updates -> Re-Install now?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8573729)
 * No. At least, as I understand the reinstall button’s process. It basically re-
   does the most recent update, which involves replacing all updated files. Files
   that were not changed remain unaffected.
 * With a manual reinstall, you first delete all of the core files. Thus every single
   file is replaced and old cruft is removed. There’s little chance of some corruption
   being inherited. For good measure, follow a similar process for themes and plugins.
 * If you still have issues after this, there would have to be something in the 
   DB that persists through the reinstall process. As you’ve already confirmed the
   capabilities are correct, I’m not sure what else would cause this. I think the
   only remaining recourse would be to trace through the post save process and identify
   the exact code that is stripping content. Once identified, there ought to be 
   some way to override it since it is not default behavior.
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8574176)
 * I see. So I could just FTP the entire 4.7 installation files over my existing
   installation to replace all files. I’ll just keep my wp-config.php and that should
   be it?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8574910)
 * Delete wp-includes and wp-admin first. There’s often files removed from the core
   set left over from other updates or other content placed improperly by other 
   entities that are good to get cleaned out. This will not happen if you just FTP
   over with what’s in the download.
 * You need to be more selective in the root directory. Keep wp-config.php and .
   htaccess of course and delete any WP files. Clean out other junk if you’re sure
   they’re junk. Keep backups just in case.
 * Same for wp-content. In theory you should be able to delete plugins and themes
   directories too, but people often customize some of these files and would lose
   their customizations. Some themes or plugins may not have available downloads
   any more. If you’re at all not sure, make backups first. You must keep everything
   in uploads. There may be useless files here, but figuring out which ones is rarely
   worth the effort.
 * Once you’ve cleaned out everything possible, _then_ you may start uploading replacement
   files.
 *  Thread Starter [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * (@antermoia)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8600922)
 * Hello everyone,
 * after I’ve tried everything to no avail, I had another look at the “SecuPress”
   plugin that I had previously used, but uninstalled.
 * It turned out that the plugin sets a value **“DISALLOW_UNFILTERED_HTML”** in 
   _wp\_config.php_ to **“TRUE”** and this overrides all user roles/capabilities,
   including the admin. The plugin did not clean up after itself when I uninstalled
   it, and left these definitions in wp_config.php (I notified the plugin developers
   about this).
 * Needless to say, I’m embarrassed to have wasted the time of you all with this
   only to find out that it was this plugin (which I had previously suspected myself,
   even! duh). I’m really sorry, but I appreciate how helpful you all were, of course.
 * Thanks, and if anyone runs into this problem in the future, they’ll hopefully
   find this conversation. 🙂
 * All the best for 2017!
    Alexander.

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

The topic ‘Editor strips some code’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [editor](https://wordpress.org/support/topic-tag/editor/)
 * [forms](https://wordpress.org/support/topic-tag/forms/)
 * [removed](https://wordpress.org/support/topic-tag/removed/)
 * [stripped](https://wordpress.org/support/topic-tag/stripped/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 4 participants
 * Last reply from: [Alexander S. Kunz](https://wordpress.org/support/users/antermoia/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/editor-strips-some-code/#post-8600922)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
