Here’s a very useful tool from the guys at W-Shadow for all of you bloggers out there! A WordPress plugin that prevents WordPress from adding backslashes or otherwise breaking your HTML code, in specially marked sections (such as JS or CSS code).
In the end I decided to just go and write a plugin that would let me put any code or script in my posts and display it to the visitor unmodified.
Requirements & Download
I have only tested it in WordPress 2.3.1, but I’m fairly certain the plugin will work in older WP 2.x versions, too. I recommend disabling the visual editor for better results – if it’s enabled enabled, some characters (e.g. the ampersand) may still be encoded.
The installation is straightforward – download the zip file, unzip, upload the raw-html folder to /wp-content/plugins and activate it in the Plugins tab.
Download raw-html.zip (2 KB)
Using the plugin
To prevent some 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).
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.
This plugin is provided AS IS, with no guarantee that it will work on your site. If it works for you, consider yourself lucky
You might also be interested in another functionally similar plugin – WP Unformatted – that works on per-post basis.