Ever have one of those days where you find yourself copying and pasting a ton of HTML code into your Wordpress install? You're making excellent progress moving data over and you feel real proud of yourself. Then something goes wrong.

The something I am referring to happened to me this evening. See, I never use the visual editor in Wordpress but tonight, after pasting several hundred articles, I went to look at the site and was horrified to see that all of my work had been copied into the visual editor and not the HTML editor!!!

Yes, I was viewing wordpress posts that were showing pure HTML to the viewer!

Being technically inclined I knew that there was no way I would spend the next hour copying from the visual editor and pasting into the HTML editor for each post. Instead I used my brain and logged directly into the database and ran the following two queries:

UPDATE wp_posts SET post_content = REPLACE(post_content,'&lt;','<')
UPDATE wp_posts SET post_content = REPLACE(post_content,'
&gt;','>')

This simple little bit of code goes through the entire wp_posts table and replaces the HTML code for the opening and closing HTML brackets with the brackets themselves for all post content.