{"id":66,"date":"2007-05-14T09:31:06","date_gmt":"2007-05-14T13:31:06","guid":{"rendered":"http:\/\/scott.sherrillmix.com\/blog\/programmer\/wp_codeshield\/"},"modified":"2008-02-04T11:26:47","modified_gmt":"2008-02-04T15:26:47","slug":"wp_codeshield","status":"publish","type":"post","link":"http:\/\/scott.sherrillmix.com\/blog\/blogger\/wp_codeshield\/","title":{"rendered":"WP_CodeShield"},"content":{"rendered":"
I’ve been burned a few times in WordPress when posting something like:<\/p>\r\n
This is how you make text italic:
This is italic.<\/em><\/code ><\/p><\/blockquote>\r\n
when I actually wanted:<\/p>\r\n
This is how you make text italic:
<em>This is italic.<\/em><\/code><\/p><\/blockquote>\r\n
Of course it’s not too hard to remember to encode the special characters but this is WordPress and things are supposed to be easy. So I thought I would throw together a simple WordPress plugin to convert HTML special characters inside
<code><\/code><\/code> tags. That was a few months ago and I got the plugin most of the way done and then got distracted with other things. But after reading about another person having the same annoyance<\/a>, I decided I should finish the plugin.<\/p>\r\n\r\n
So here is WP_CodeShield. It simply looks for
<code><\/code><\/code> tags in posts and comments and makes sure the contents are encoded properly. You just type the code you want inside
<code><\/code><\/code> tags and it should appear correctly. So you can type
<code><em>This is italic.<\/em><\/code><\/code> instead of
<code><em>This is italic.<\/em><\/code><\/code>.<\/p>\r\n
If you have any questions, suggestions or requests, please leave them in the comments below. You can also test WP_CodeShield out in the comments if you are curious.<\/p>\r\n\r\n
Current Version:<\/h3>