My fourth WordPress Plugin has the name Enable RAW HTML – Disable Corruption. It switches all the filters for your content off. Everything you type will be sent to your visitor’s browser. The filters are wp_autop, convert_chars, wptexturize.
If you need the same functions not only for posts and pages but also for excerpts or something else, have a look in the source and edit what you need. You can even enable PHP execution if you want.
There are many plugins like this, but this is the most effective. Now you get what you type.
14 thoughts on “Enable raw HTML and execute PHP in WordPress”
It doesn’t work on the excerpts. Any ideas why?
WordPress takes your posts and writes them into your blog. On the way it modifies the text and adds P elements, nice quotation marks and so on. This is done by so called filters.
Please have a look in the source code of my plugin. remove_filter disables these filters and add_filter enables a filter. In this case it is a filter that executes PHP code. If you want the plugin to work on excerpts too, copy the commands you need and replace “the_content” by “the_excerpt”.
It is very simple to change the behaviour of this plugin.
OK, I’m very new to all this, so bear with me.
The plugin seems to work great for me, but I’m a bit confused because I didn’t have to enclose my html code in any special tags or anything like that.
It seems that for other plugins, you need to enclose the code you want left alone in special tags.
They also make a big deal out of not ever using the Visual editor or it will mess things up again.
So how does it work with this plugin? What if I use the Visual Editor on other parts of the page or for other pages and then just do my final clean-up with the html editor? Will it mess things up?
The visual editor relys on the filters that this plugin disables. Therefore the output of the visual editor will be broken. P elements will be missing. The reason I created this plugin is that I wanted to have full control over the output. The HTML editor was not bare enough for me.
If you use the visual editor that often generates defective code you have to switch to the HTML editor and tidy up. Don’t forget to add P elements if you use this plugin because the visual editor does not add them and this plugin disables the automated generation of ’em.
is it also possible to replace #038; and $amp to only an $?
Using this plugin, if you write a & symbol you will get it. There is no replacement. But the browser will change & to &.
This sounds like the ideal solution as I am so frustrated by the visual editor always changing my code. Only problem is I have installed the plugin but it does not work, visual editor is still doing it’s annoying old thing. Any suggestions? Thanks in Advance.
The plugin does not work with the visual editor. It is made for people who think that the HTML editor produces ugly code and not for those who believe in WYSIWYG. A good completion for this plugin could be an editor with syntax highlighting. But I do not know any.
Just since it isn’t explicitly mentioned… this still keeps the filters on third-party comments, right?
Yes. Have a look in the sources to adjust this behaviour.
I pruchased and installed right now this ‘Enable RAW HTML – Disable Corruption’ plugin, but somehow it will not work on my site. Also when staying in the ‘code editor’ it adds these ‘p’ tags. And those again are deleting my links.
what I could have done wrong?
You purchased it? Nice, but I do not sell it. It’s free. You should not use the WYSIWYG editor because it destroys your markup.
… somehow I installed this ‘raw HTML’, and from there I came to upgrade to ‘pro’. This I did.
but I realised now that even with ‘this’ pro version I have to use the brackets ‘[raw] [/raw].
it works so far now,
sorry to bother you.
This is not my plugin. I do not use [raw] tags.