Raw HTML Plugin for WordPress
Introduction
Recently I needed to put some style definitions and a JavaScript function in a post on another blog that I have. I wasted several hours trying to do this, because WordPress insisted on putting backslashes in front of my apostrophes, inserting superfluous <p> or <br /> tags in place of newlines, and generally breaking my HTML in various horrible ways.
In the end I decided to just go and write a plugin that would let me put any code or script (e.g. JavaScript) in my posts and display it to the visitor unmodified.
Download & Installation
raw-html.zip (3 KB)
Requirements :
- WordPress 2.6 – 3.0
- Disable visual editor for better results – some characters (e.g. the ampersand) may still be encoded if it’s enabled.
Installation is straightforward – download the zip file, unzip, upload the raw-html folder to /wp-content/plugins and activate it in the Plugins tab.
Usage
There are two ways to use the plugin. First, to turn off “smart quotes” and other built-in filters for an entire post, use the checkboxes that Raw HTML adds to the “Write” screen (requires WP 2.5+) :

If you want to prevent a specific part of your post or page from being processed and “texturized” by WordPress, wrap it in <!–start_raw–>…<!–end_raw–> or [RAW]…[/RAW] tags. The two versions work exactly the same, but the latter may be handy if you’re using the visual editor (not recommended).
Example :
<!--start_raw-->
This
is
a 'test'!
<!--end_raw-->
Result :
This
is
a 'test'!
If you view the source code of this page, you will see that the newlines are still there, and the apostrophes haven’t been converted/escaped.
Other Notes
This plugin is provided AS IS, with no guarantee that it will work on your site. If it works for you, consider yourself lucky
A temporary solution would be a “remember selection in a cookie” checkbox. How about that?
Argh, fine. I’ve added a “Raw HTML defaults” panel to the “Screen Options” box (and it only took me two days to figure out how to do that
). You should get an update notification soon.
Awesome!!! Thanks, m8!
“I’ve added a “Raw HTML defaults” panel to the “Screen Options” box…”
I’ve just updated and looked for this panel and can’t find it anywhere
Any ideas?
What’s your WP version? It will only show up in 3.0.
BG: it shows up when you click “screen options” in the top right corner during new post composition.
This works fantastic, you just saved like an hour of everybody’s lives
The default settings should also work when I uncheck the RAW HTML box in the screen options, correct?
Mmm, no. But you can collapse the box and put it at the bottom of the page, and the defaults will be applied when you save/update a post.
Ok, thanks
Got it now, many thanks!
[...] Raw HTML capability by Janis Elsts [...]
Just wanted to let you know that the defaults do work even if the raw html box is hidden in the screen options. Testen on a handful of posts

This is great!
You may want to consider adding a explanation on where to find the defaults. The FAQ of WP Plugins repository would be a good place to publish it on
Right.
Doesn’t work for me – WP 3.0.
jamey try this: http://catb.org/esr/faqs/smart-questions.html
I’m having a weird issue where this plugin works perfectly for some users, but strips ids for others.
I’m using WordPress 3.0 with multisite turned on. Users who are Super Admins on the site have no trouble; everyone else is having trouble.
What do you mean by “strips ids”?
I have a chunk of code:
[RAW]
stuff
When certain users try to use that, it strips out the id=”somename” and just leave the div there. Nothing else is changed.
The comments keep eating my div tags!
I want to change some of the html on my WordPress home page. Can I do this with raw-html?
Suppose I create an entirely new page using HyperEdit or another html editor. Can I copy the source code from there and create a WordPress page by using raw_html?
Assuming you only want to change the content part of the homepage – yes. However, if you need to change things in the sidebar, header and so on, something like a custom page template would probably work better.
[...] Raw HTML Plugin for WordPress | W-Shadow.com – Permet l’insertion du code dans wordpress sans interprétation, évitant des problèmes pour le code html, javascript etc. Filed under Bookmark Tagged annuaire, intallperso, logiciel, outils, piwik, plugins, pratique, server, web, WordPress Comment (RSS) | Trackback | Permalink [...]
[...] Check Raw HTML Plugin for WordPress [...]
[...] Raw HTML: “In the end I decided to just go and write a plugin that would let me put any code or script (e.g. JavaScript) in my posts and display it to the visitor unmodified.” [...]
[...] Raw HTML Capability by Janis Elsts RawHTML lets you use any HTML or JavaScript code without WP messing it up. It also [...]
Thanks for your work on this plugin – I have it installed on WP3.0.1 and it seems to be working for me apart from WP (the insatiable beast) wrapping the commented tags:
and
which upsets the intended layout a little.
Any comments on this would be greatly appreciated.
Cheers
ah ok, no luck posting code on comments
– anyway the !–start_raw– tags get wrapped in paragraphs
Try putting the tags inline with other content, like this :
Thank you!
it’s a very useful plugin
I have a studio press them and your plg in doesn’t work
I was tensed searching for this, thanks my friend. Now html are looking good !!!