Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

HTML edits being stripped WordPress



I'm trying to put code for an image map into the HTML tab in the new post edit page.

It's stripped every time. I've disabled all plugins, re-installed 3.0.4, and disabled the visual editor completely. Still the code I put in for this page gets stripped. I've tried it on other pages, and creating a new page, and it's still stripped.

I'm tried simply adding


to see if it's code in between...and it's still deleted.

I've tried the image map code on another blog I run, up to date Wordpress, less history, and it's kept the code without issue.

I've changed themes on the blog in question and it's still stripped.

I can only assume there's some sort of lingering code effecting the editor or some crazy issue I can't even think of troubleshooting.

Please offer suggestions, I'm dying here. The code is stripped but there is blank space in the exact amount of rows, including indentations as the code after I update which just adds to the confusion.

I created a video to exemplify.

Thank you for anything you can offer.



Robert Granholm

Answers (7)


Joachim Kudish answers:

As somebody above alluded to, only administrators (and in some cases editors) can post unfiltered HTML. My guess is that your user table might be corrupted or somewhere along the way your user lost that capability. Try creating a new admin user and doing with that user.

This post by Nacin explains it in more details

robgranholm comments:

I though you might be right and got excited at the chance. I tested it. Created a new user, logged out, logged in as change...still gets stripped out. Thanks. Other ideas?

Joachim Kudish comments:

As others have already said. This is for sure a user role problem. I am 95% certain that somehow your administrator user level doesn't have that capability. That might be caused by either by an older plugin, a corrupted database or even an older plugin that left some data in there. If you a clean reinstall of WordPress you will see that it works.

A few things to check for:
Do you have this code in your wp-config.php?
If you do, then remove it. That constant disallows unfiltered html.

Are you running multisite or normal WordPress?
If running multisite, only Super Admins can post unfiltered html.

This plugin is made for multisite but having looked at the code, it should also work for a normal install:
Try installing it.

robgranholm comments:

I think the administrator role is on the right track, so I'm glad about that and not spending hours digging into the editor, and plugins that effect it. I'll update here after I've messed with the MU plugin. It's ironic because the site in question is one to help online entrepreneurs with the technical aspects and troubles they come across, wordpress being one of them...we all need help sometimes, that's the truth.

Joachim Kudish comments:

For sure this is the right path.

I'm a [[LINK href=""]]professional web developer[[/LINK]] and specialize in WordPress. Not trying to advertise my services, but am willing to help out. If you want to contact me at [email protected] I'd be happy to take a very quick look for free.


Peter Michael answers:

Does this happen with the TwentyTen theme?

robgranholm comments:

No, it's not the twenty ten theme, it's a custom theme built from the Primepress theme originally

Peter Michael comments:

If the problem does NOT occur with the TwentyTen theme, then I'd check the custom theme for occurrences of add_filter('the_content', ... and comment them out if there are any.


Andrzej answers:

can you post the code you want to paste in some pastebin or sth?

Andrzej comments:

Can you also share us the password for [[LINK href=""]][[/LINK]] ?

robgranholm comments:

Here's the code I'm trying to put into the HTML tab and not moving back and forth or anything like that.


<map name="GraffleExport">
<area shape=poly coords="678,583,677,583,677,582,677,572,677,572,678,572,686,577,686,577,686,578,678,583,678,583" href="">
<area shape=poly coords="687,570,687,584,673,584,673,570,687,570" href="">
<area shape=poly coords="537,560,694,560,701,567,701,587,694,594,537,595,529,587,529,568,537,560,537,560" href="">
<area shape=poly coords="677,538,677,538,677,537,677,527,677,527,678,527,686,532,686,532,686,533,678,538,677,538" href="">
<area shape=poly coords="687,525,687,539,673,539,673,525,687,525" href="">
<area shape=rect coords="529,515,701,549" href="">
<area shape=poly coords="677,452,677,452,677,452,677,442,677,441,678,441,686,446,686,447,686,447,678,452,677,452" href="">
<area shape=poly coords="687,440,687,454,673,454,673,440,687,440" href="">
<area shape=rect coords="529,430,701,464" href="">
<area shape=poly coords="677,366,677,366,677,365,677,355,677,355,678,355,686,360,686,360,686,361,678,366,677,366" href="">
<area shape=poly coords="687,353,687,367,673,367,673,353,687,353" href="">
<area shape=rect coords="529,343,701,377" href="">
<area shape=poly coords="677,409,677,409,677,408,677,398,677,398,678,398,686,403,686,403,686,404,678,409,677,409" href="">
<area shape=poly coords="687,396,687,411,673,411,673,396,687,396" href="">
<area shape=rect coords="529,386,701,421" href="">
<area shape=poly coords="677,246,677,246,677,245,677,235,677,235,678,235,686,240,686,240,686,241,678,246,677,246" href="">
<area shape=poly coords="687,233,687,247,673,247,673,233,687,233" href="">
<area shape=rect coords="529,223,701,257" href="">
<area shape=poly coords="677,287,677,287,677,287,677,277,677,276,678,276,686,281,686,282,686,282,678,287,677,287" href="">
<area shape=poly coords="687,275,687,289,673,289,673,275,687,275" href="">
<area shape=rect coords="529,265,701,299" href="">
<area shape=poly coords="676,164,676,164,676,164,676,154,676,153,677,153,684,158,685,159,684,159,677,164,676,164" href="">
<area shape=poly coords="686,152,686,166,671,166,671,152,686,152" href="">
<area shape=rect coords="528,142,700,176" href="">
<area shape=poly coords="677,124,677,124,677,123,677,113,677,113,678,113,686,118,686,118,686,119,678,124,677,124" href="">
<area shape=poly coords="687,111,687,125,673,125,673,111,687,111" href="">
<area shape=rect coords="529,101,701,135" href="">
<area shape=poly coords="677,83,677,83,677,83,677,73,677,72,678,72,686,77,686,78,686,78,678,83,677,83" href="">
<area shape=poly coords="687,71,687,85,673,85,673,71,687,71" href="">
<area shape=rect coords="529,60,701,95" href="">
<img border=0 src="" usemap="#GraffleExport">

<h1 style="text-align: center;"><strong>Introduction</strong></h1>

<p style="text-align: center;">httpvh://</p>

<p style="text-align: center;"><strong>---</strong></p>


robgranholm comments:

The password is "trainer"

Andrzej comments:

Lew's comment about user capabilities is interesting. During WP installs I guess you haven't been re-creating your database? Some currupted db entries might be the issue.

Probably the fastest way to check would be installing [[LINK href=""]]this plugin[[/LINK]]. Then, you might want to check if your 'administrator' role has a capability of 'unfiltered_html' enable. Basically admin should have all these stuff on.

robgranholm comments:

Yes, they were all turned on in the capabilities plugin and I hit save just to see if it would overwrite anything. No change in action. I created new user with administrator status and ... same...still gets stripped out.


Lew Ayotte answers:

Is your user an Administrator user?
Do you have any custom functions in your functions.php?

I tried <map></map> in TwentyTen theme as an administrator and it worked fine...

Lew Ayotte comments:

Contributor and Author strips out the <map></map> for me... Administrator and Editor doesn't.

But none of them caused all those blank lines that you had.

There is a capability added to Admins and Editors by WP Default:

$role =& get_role('administrator');

$role =& get_role('editor');

Depending on your role, you could add the same capability to that role and see if it makes a difference.

robgranholm comments:

I'm an admin and the only user. Unless this could have been corrupted somehow I don't think it's an Admin issue. I haven't seen any other issues that hint to administrator or access issues, but I'm willing to explore anything.

Lew Ayotte comments:

Yes, but did you try adding the code I mentioned in your functions.php? It will add those capabilities back to your Admin user (if it was removed by some other plugin or theme).


Dan | gteh answers:

I suggest using which is a much better editor and does not strip out code the same way the default one does.

then again, if you've disabled the visual editor completely and still have the problem then Im not too sure.

Have you tried installing a brand new copy of WP in a temp location with a new database to rule out any database corruption?

robgranholm comments:

I've tried the foliopress plugin. It doesn't work. I've just jumped over to another WP install (created in the last month) ... on the same server but a different domain name ... different database ... the code works fine and is not stripped out.


Oleg Butuzov answers:

1) add this to custom field (calld it the_content_custom_fiild)
2) at the sigle.php (for blog posts) or page.php after the the_content() function runs type next
3) <?php echo apply_filters('the_content', get_post_meta(get_the_ID(),'the_content_custom_fiild', true));?>

Oleg Butuzov comments:

simple and smart =)))

robgranholm comments:

Can you explain a little more about this solution? I think I follow but I'm not sure if there are some errors in it...and adding a custom field to every page I want doesn't seem like a fix, but I'd like to hear more about it.

Oleg Butuzov comments:

Additional fields is meta data for the posts/pages/etc. its like a additional cels for the data attached to your post. you always can delete tham via "post edit" . however that require to be also additionaly coded to your theme files (that i tell you to write after the the_content(); code)...

ants best sollution fot this issue with is not wp issue. if you have a single user and its administrator its should be working. at least its working in all my installations. so i think this is some third software problem (perhaps theme or plugin) with make additional cleaning for the editor_content. so... if we can't use edor content, we should use additional data for that proposes.


Andrew C answers:

you should also add this to your functions.php so text is saved correctly:

remove_filter('the_content', 'wptexturize');
remove_filter('the_title', 'wptexturize');
remove_filter('single_post_title', 'wptexturize');
remove_filter('category_description', 'wptexturize');
remove_filter('list_cats', 'wptexturize');
remove_filter('comment_author', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_rss_content', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
// remove_filter( 'the_content', 'wpautop' );
// remove_filter( 'the_excerpt', 'wpautop' );

codex ref:

I would also look into adding "custom fields" within your pages. Then create if-statements inside your page.php to display/run the code. I've done it, and it works perfectly.