Title: Preserved HTML Editor Markup
Author: MarcusPope
Published: <strong>Oktubre 28, 2011</strong>
Last modified: Setyembre 3, 2012

---

Maghanap ng mga plugin

Ang plugin na ito ay **hindi pa nasusubukan sa pinakabagong 3 major release ng WordPress**.
Maaaring hindi na ito minamantine o sinusuportahan at maaaring may mga isyu sa compatibility
kapag ginamit sa mas bagong bersyon ng WordPress.

![](https://s.w.org/plugins/geopattern-icon/preserved-html-editor-markup.svg)

# Preserved HTML Editor Markup

 Ni [MarcusPope](https://profiles.wordpress.org/marcuspope/)

[I-download](https://downloads.wordpress.org/plugin/preserved-html-editor-markup.zip)

 * [Mga Detalye](https://tl.wordpress.org/plugins/preserved-html-editor-markup/#description)
 * [Mga Review](https://tl.wordpress.org/plugins/preserved-html-editor-markup/#reviews)
 *  [Pag-install](https://tl.wordpress.org/plugins/preserved-html-editor-markup/#installation)
 * [Development](https://tl.wordpress.org/plugins/preserved-html-editor-markup/#developers)

 [Suporta](https://wordpress.org/support/plugin/preserved-html-editor-markup/)

## Deskripsyon

This plugin preserves the user-generated HTML markup in the TinyMCE editor. Unlike
other plugins this one allows developers to work in the HTML tab AND end-users to
work in the WYSIWYG Visual tab at the same time! No longer will your HTML markup
be completely munged into an unrecognizable form when you switch between those tabs.
And you don’t have to hang your users/editors out to dry when you hand off the project
with a disabled Visual tab.

#### IMPORTANT: Please read the installation instructions carefully. If you have existing content it will not render properly after activating this plugin until you use the Fix It Tools.

(One user didn’t read or follow these steps and panicked thinking I ruined their
website.)

It also supports HTML5 Block Anchor tags in addition to other HTML5 elements, something
that is currently not supported in WordPress via any existing plugins.

Version 1.5 will probably be the last version I release for a while since my daughter
will be born soon. I’ve added support for full JavaScript code blocks in the HTML
tab. They are compatible and preserved when switching to Visual mode. This rounds
out the support for almost complete html preservation, with full use of the WYSIWYG
editor. And you don’t need to wrap comment codes around it per the recommendations
located here: [https://codex.wordpress.org/Using_Javascript](https://codex.wordpress.org/Using_Javascript)
but you can leave them in if you want.

Version 1.4 was just a minor patch release. User @denl noticed a problem with the
plugin CataBlog which implements its own administrative management features by disabling
the ‘show_ui’ flag for its custom post type. I was ignoring any custom post type
that didn’t have a GUI, but it was an unecessary filter that probably limited other
plugins. This fix allows any post type that supports the TinyMCE editor to be “fixed”
using the tools under Admin > Settings > Writing.

Since version 1.3 you can now use inline CSS and JavaScript in the HTML editor and
everything should be preserved. To be clear, this applies to tags only, like `onclick`
events and style definitions – not script blocks themselves. To enable this feature
you must disable the `wptexturize` and `convert_chars` filters by adding the following
code to your theme’s `functions.php`:

    ```
    remove_filter("the_content", "wptexturize");
    remove_filter("the_content", "convert_chars");
    ```

This new feature is pretty experimental at the moment. I tried to make it compatible
with wptexturize but that proved close to impossible without duplicating a lot of
core code in my plugin. It’s also not compatible with TinyMCE Advanced when the “
stop removing p and br tags” setting is enabled.
 I’ve tested it on a variety of
code samples and I’m pleased with the results but if you find any content that isn’t
preserved just open a support ticket and I should be able to fix it.

Since version 1.2, you now have a little more control over how content is created.
And most of the previous caveats to using this plugin are now resolved.

 1. You can now choose whether to use BR tags OR P tags for newlines. Even better you
    can use both, where one return key press injects a BR tag, and two return key presses
    will wrap a Paragraph tag. This is great for being able to wrap headers at specific
    break points all while enjoying the semantic perks of paragraphs.
 2. In addition to choosing what type of tags to use, you can also change the behavior
    depending on the type of post, including custom post types. So Pages can default
    to BR tags, and Blog Posts can default to Paragraph tags.
 3. If you have existing content that was created before activating this plugin, you
    can now use the Fixit feature to convert your existing content in a way that makes
    it render the same as before. Only use this feature (located under Admin > Settings
    > Writing: Fixing Existing Content) if you are installing this plugin for the first
    time, otherwise it will remove all of the formatted white space in your posts.
 4. Multi-line HTML comments are now supported (Thanks to [@cwlee_klagroup](https://wordpress.org/support/profile/cwlee_klagroup)
    for suggesting the working fix!)
 5. The Format drop down in the TinyMCE editor had a bug which is now fixed. It will
    now select “Format” if you place the cursor on a section of bare text. Currently
    the editor just leaves the previously selected format option in place. It’s minor
    but it’s good to know when you have bare text in your content.
 6. There was a fairly problematic bug in the old version where in some browsers you
    couldn’t change the formatting of a single line in the Visual editor if you started
    from scratch. Choosing a different Format option would change the entire document,
    with the only work around being to edit the document in HTML mode. That was bad,
    and somehow went unnoticed for far too long. Anyway, that is fixed now.

The caveats that still remains are:

 1. With script blocks added to your HTML markup, the right arrow key does not pass
    over them in the Visual Tab. You can down arrow over them however so this will 
    likely never be addressed.
 2. If you use the Paragraph tag setting for newlines there is a minor bug where it
    will only wrap your content in Paragraph tags if you specify Paragraph in the Format
    drop down or if you enter more than one paragraph of text. So if you just type 
    one sentence and click save it will not wrap the content in Paragraph tags. I tried
    to fix this but ran out of my allotted time working on other core issues. Should
    be fixed in the next release.
 3. For performance reasons, it will only preserve spaces if 4 spaces are used consecutively–
    i.e. an expanded tab in developer terms. It will not preserve intra-tag white space
    like <p    >.
 4. If you do add 4 or more spaces inside of an element tag it will corrupt the markup
    and mangle the output. But as this is intended for developer edits, this should
    be an extreme rarity given the habit is virtually non-existent in development communities.
 5. PRE tags are not affected and behave as you would expect, however due to how browsers
    parse tags, the first newline in the content of a PRE tag will be wiped out unless
    it is padded with either another new line or multiple spaces.
 6. CODE tags are not preserving white space at all, and when wrapped with PRE tags
    white space is still removed. I’m working to resolve this problem.

### Arbitrary section

## Pag-install

 1. Upload the plugin contents to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress Admin
 3. If you have existing content that needs fixing, use the “Fix Posts” feature under
    Admin > Settings > Writing: Fix Existing Content.
 4. You’re done!

## FAQ

  Installation Instructions

 1. Upload the plugin contents to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress Admin
 3. If you have existing content that needs fixing, use the “Fix Posts” feature under
    Admin > Settings > Writing: Fix Existing Content.
 4. You’re done!

  When will code tag issues be resolve?

This is a tough one. Not only do I have no idea why they’re being trumped, but I
also have a daughter that will be born pretty soon :D, and a project at work that
is about to get hectic 🙁 I’ll try to fix it when I can but if you have the skills
to help debug the help would be greatly appreciated.

  Does this plugin actually disable wpautop?

Yes. And unlike virtually every other “disable wpautop” plugin this one will actually
disable the client-side version of wpautop that runs when you switch between the
Visual and HTML tabs. Even when using the P Tag mode or hybrid mode, wpautop is 
disabled and custom code is being used to inject paragraphs a little more intelligently.

  What exactly do the “Fix Posts” or “Fix XXX” buttons do to my content?

Firstly, only use this feature if you are starting new with version 1.2. And definitely
backup your database before running these tools, they have only been tested on two
sites so far. And although in theory it is safe, you should still protect yourself.

The fix actually just runs wpautop one final time on the posts in the database. 
By default WordPress runs that function every time it displays content, so the raw
data in the database is free of any paragraph tags & other formatting tweaks. The
Fix buttons update the raw content in the database with the formatted version wpautop
produces. And fortunately wpautop was designed in a way that it can be run multiple
times so it shouldn’t mangle your content.

All of your post content will be converted, including past revisions. So if you 
need to revert a page or post after you activate this feature, you won’t have to
reformat the previous version by hand.

The plugin also keeps track of when it was activated, so it will only modify content
that was edited before the plugin was activated. So if you created some new content
after activating the plugin and later realized all of your other content wasn’t 
displaying correctly it’s safe to use the Fix buttons without ruining your new content.

## Mga Review

![](https://secure.gravatar.com/avatar/6ae08e002b91c1c25e119c54fed17004ab29a176105b2191942e4bafe1498a55?
s=60&d=retro&r=g)

### 󠀁[It really works.](https://wordpress.org/support/topic/it-really-works-61/)󠁿

 [John Clifford](https://profiles.wordpress.org/johnfclifford/) Hulyo 27, 2020

Look no further. This plugin is under-publicised and very good. Took me ages to 
find it. It works for me with 5.4.2 in July 2020. Prevents the TinyMCE editor from
messing up a div wrapped in an href.

![](https://secure.gravatar.com/avatar/691e181705ab77d5c38e808f3907faa27b4d8b761104a7e74f890262df344482?
s=60&d=retro&r=g)

### 󠀁[Almost works](https://wordpress.org/support/topic/almost-works-6/)󠁿

 [nuvoPoint](https://profiles.wordpress.org/nuvopoint/) Setyembre 3, 2016

Doesn’t seem to retain formatting in new code when editing via the visual editor
and then going to the text editor. Vice versa seems to work. Good work though. Hoping
for an update soon, a long time has passed and we’re at WP 4.5.2 now, which has 
its own enhancements.

![](https://secure.gravatar.com/avatar/8c76e331f3c3f0fc04910346a2074eaf288b80f05be834cc7a0f5a3f9723e9b8?
s=60&d=retro&r=g)

### 󠀁[Great!](https://wordpress.org/support/topic/great-4523/)󠁿

 [brazilkorea](https://profiles.wordpress.org/brazilkorea/) Setyembre 3, 2016

It worked! Thank you! And I wish you and your daughter to be always healthy~

![](https://secure.gravatar.com/avatar/7cfdf34ae490088e3e4b3029e547d85fa323cd0dc808c9833d76270801ddeed1?
s=60&d=retro&r=g)

### 󠀁[Thank god](https://wordpress.org/support/topic/thank-god-7/)󠁿

 [chrisbeaman](https://profiles.wordpress.org/chrisbeaman/) Setyembre 3, 2016

It’s November 2015 and this plugin still works great. Hasn’t been updated in 2 years.
Thank you, plugin author!

![](https://secure.gravatar.com/avatar/b87644f25200be1605031513a75b9cd31cba292159b9942c7d5bec55b37b8f9c?
s=60&d=retro&r=g)

### 󠀁[awesome!!!](https://wordpress.org/support/topic/awesome-4045/)󠁿

 [Jules Colle](https://profiles.wordpress.org/jules-colle/) Pebrero 7, 2017

finally found what i was looking for! it’s a shame I have to install a plugin to
remove wordpress features, but I think wysiwyg editors ask for trouble all the time
and I don’t think the wordpress core devs have had the courage to completely neutralize
the auto-formating built into tinymce. You however, have done a really nice job 
tackling A LOT (maybe all?) of the formatting hick-ups.

 [ Basahin lahat ng 42 na review ](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/)

## Mga Contributor at Developer

Ang “Preserved HTML Editor Markup” ay open source software. Ang mga sumusunod na
tao ay nag-ambag sa plugin na ito.

Mga Contributor

 *   [ MarcusPope ](https://profiles.wordpress.org/marcuspope/)

[Isalin ang “Preserved HTML Editor Markup” sa iyong wika.](https://translate.wordpress.org/projects/wp-plugins/preserved-html-editor-markup)

### Interesado sa development?

[Tingnan ang code](https://plugins.trac.wordpress.org/browser/preserved-html-editor-markup/),
i-check ang [SVN repository](https://plugins.svn.wordpress.org/preserved-html-editor-markup/),
o mag-subscribe sa [development log](https://plugins.trac.wordpress.org/log/preserved-html-editor-markup/)
sa pamamagitan ng [RSS](https://plugins.trac.wordpress.org/log/preserved-html-editor-markup/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.4

 * Removed ‘show_ui’ filter for fix custom post type buttons.

#### 1.3

 * Added support for inline JavaScript and CSS, as long as the wptexturize and convert_chars
   filters are disabled. (Thanks to ViennaMex for pointed out the problem.)
 * Added cache-buster for this plugin’s JavaScript includes to prevent upgrade issues
   seen in version 1.2 (Thanks to dreamdancerdesign, peterdub & abbyj for troubleshooting
   support.)
 * Special thanks to dreamdancerdesign for providing a live testing server – above
   and beyond.

#### 1.2

 * Added support for user-specified newline behavior per post type
 * Added support for multi-line html comments (Thanks cwlee_klagroup!)
 * Fixed a bug found in TinyMCE related to Format drop down
 * Added tools to convert existing site content programmatically by post type.

#### 1.1

 * Refactored for support of < php5.3 by replacing function references with static
   function array refs

#### 1.0

 * Initial creation of plugin

## Meta

 *  Bersyon **1.5**
 *  Huling na-update **8 taon ang nakalipas**
 *  Mga aktibong installation **700+**
 *  Bersyon ng WordPress ** 3.2.1 o mas bago **
 *  Sinubukan hanggang **3.4.2**
 *  Wika
 * [English (US)](https://wordpress.org/plugins/preserved-html-editor-markup/)
 * Mga Tag
 * [editor](https://tl.wordpress.org/plugins/tags/editor/)[html](https://tl.wordpress.org/plugins/tags/html/)
   [markup](https://tl.wordpress.org/plugins/tags/markup/)[white space](https://tl.wordpress.org/plugins/tags/white-space/)
   [wpautop](https://tl.wordpress.org/plugins/tags/wpautop/)
 *  [Advanced View](https://tl.wordpress.org/plugins/preserved-html-editor-markup/advanced/)

## Mga Rating

 5 out of 5 stars.

 *  [  40 5-star reviews     ](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/?filter=5)
 *  [  2 4-star reviews     ](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/#new-post)

[Tingnan lahat ng review](https://wordpress.org/support/plugin/preserved-html-editor-markup/reviews/)

## Mga Contributor

 *   [ MarcusPope ](https://profiles.wordpress.org/marcuspope/)

## Suporta

May gusto kang sabihin? Kailangan ng tulong?

 [Tingnan ang support forum](https://wordpress.org/support/plugin/preserved-html-editor-markup/)

## Mag-donate

Gusto mo bang suportahan ang pagpapaunlad ng plugin na ito?

 [ Mag-donate sa plugin na ito ](http://www.marcuspope.com/wordpress)