Workshop: How to post Source Code in your Comments

In this workshop I’ll show you how you can make source code show up in your comments. I’ll also show you how to format it so it looks different to ordinairy text.

By default, WordPress strips out most HTML tags for security reasons. That’s a good thing, however if you’d like to share some HTML or PHP source code with someone it won’t show up. The workaround is to paste the code into an empty post via the visual editor, then switch to the HTML editor and copy the resulting transcoded characters.

This works because single characters are not executable by the web browser and hence do not pose a security risk. It’s a bit tedious if you deal with code a lot, but it’s a safe solution and does not require any plugins.

Enjoy!





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.