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 disable the automatic formatting that WordPress applies to post content. This plugin adds a set of shortcodes that you can use to “protect” specific parts of your post and prevent WP from messing with them.
Download & Installation
Requirements :
- WordPress 2.8 or later
- If you use the free version, I strongly recommend disabling the visual editor. It (the editor) can mess up your code even if you use this plugin.
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 “Edit Post” screen:
If you want to prevent a specific part of your post or page from being processed and “texturized” by WordPress, wrap it in ... or <!–raw–>…<!–/raw–> tags. The two versions work exactly the same, with one exception – the <!–raw–>’s won’t be visible to your visitors even if you deactivate the plugin.
Example :
<!--raw-->
This
is
a ‘test’!
<!–/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.
Related posts :
@Aardvark – Yes, it hasn’t been extensively tested with the visual editor.
[…] Raw HTML capability; […]
Is it possible to apply the plugin to all posts and pages? (without using the [raw][/raw] every time)
@nirsound – not in this implementation, but it’s an interesting idea.
This is a great plugin
I’ve been looking all over the Internet for a way to do this. Thanks for sharing and making my day even better!
Thanks! I am looking forward to general setting “Apply Raw HTML to all posts and pages” in the next release…. 😉 Meanwhile, can you think of a simple change to the plugin code to force wordpress to default to Raw HTML mode? (without writing the {!–start_raw–}{!–end_raw–} every time)
When I finally get around to updating my old plugins, perhaps 😉
[…] HTML Update The Raw HTML plugin has been updated! In case you didn’t know, Raw HTML is my WordPress plugin that lets you use […]
[…] Another case if we want to put any special characters (apostrophie, quote) and any script. To enable javascript and put RAW HTML inside wp post, we must install RAW HTML […]
I really love this plug in (the raw html one). I am new at wordpress blogging and it was so easy!
Thanks!!
tnx a lot, this is the most critical plugin I use
Unfortunately, when I tried this, I still had the problem I was having before – with the auto-formatting, if I put line breaks in my table coding to make it manageable, there will be a huge block of space above each table, the sum of all the line breaks in the coding. on LJ, I know that turning the auto-formatting off will fix that and I was hoping that this would do the same. Unfortunately, I still got the large chunks of space, both when I checked the box and when I ran the !-start_raw codes.
Hmm, how about an example of the problematic HTML?
Was wondering, (new to WP) how one goes about disabling the Visual Editor?
Thanks.
You can turn off the visual editor in Users -> Your profile. Tick the “Disable visual editor when writing” checkbox on that page.
OMG, I don’t know how I missed that [embarrassed]. Thank you.
Great plug-in too btw, thanks for sharing.
Thank, you! This is a fantablous plugin!!!
I’ve used this in the past and it’s worked brilliantly – however with a fresh install of WP 2.7 -> 2.71 it seems to be ignored… anyone else having this problem?