Displaying HTML tags in a WordPress post

So, you’re creating a new WordPress post, and to illustrate your point you need to display some HTML tags in the body of the post. You type everything up perfectly and hit Publish.


When you view your post, however, your HTML tags have disappeared and your post looks to have been dismembered while you weren’t looking. What happened?

What happened is that WordPress “helpfully” interpreted each of your HTML tags, so rather than displaying them, it’s using them to format your content. When you got back into the text editor window, your tags will be gone.

The trick is to enter the tags while you’re in Visual editing mode. When done this way, WordPress will “escape” the opening < and closing > of each tag, so the tags will be displayed rather than interpreted.