If you’ve ever tried to insert code into a WordPress post, one of the following has probably happened to you:

  • Your HTML code was rendered as such.
  • WordPress stripped the code from the post entirely.
  • WordPress turned "straight quotes" into “curly quotes” — not good if you want your users copying/pasting code from your blog!

Here’s how to get around these annoying problem and make the code show as-is:

  1. Put the code into a basic text processing program (like Notepad), and perform the following find/replace operations:

    Find Replace
    < &lt;
    > &gt;
    " &quot;
  2. Click the “Code” tab on the WordPress post composition page, and then paste in the “fixed” code.

  3. Be sure to encase your code in a <code> tag for purposes of semantic correctness.

Check out the Writing Code in Your Posts WordPress Codex article for more lengthy take on the issue.