Pasting Source Code in Posts

I’ve always used the <pre> and <code> tags to show code in WordPress posts. This isn’t very good because the formatting always goes wrong because the lines don’t wrap automatically. Today, I discovered that some other bits of code causes WordPress to close the block and then screw up the display of all subsequent lines.

A bit of Googling led to a solution. Turns out that this is actually a common enough problem to be properly supported in All you have to do is to use the ‘sourcecode’ shortcode. See the link below for instructions.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s