WordPress Logo

Adding Code To Wordpress Blogs And Comments

5th February 2009 - 3 minutes read time

Wordpress is a pretty neat blogging platform, but it falls over quite spectacularly when trying to write code in posts. I write a lot of code for #! code and so I have understand what needs to be encoded to make code examples work.

For code example on #! code I use the code tag and I encode the following characters.

< into <
> into >
" into "
' into '

Note: You must be in HTML mode in your Wordpress editor or everything will be double encoded.