Not so funny problem with extra code

If you are like me and prefer a safe, elegant and fast browser you are NOT using Internet Explorer, right? But are you actually checking your blog or site from time to time in Internet Explorer or other browsers? I did today, and the result was a loud !YIKES! All over the blog posts I found strange lines of code such as “<!–[if !supportEmptyParas]–> <!–[endif]–>” and “<!–[if !supportEmptyParas]–>”. Where the heck did they come from? Guess what? It was my own mistake!

I prefer to write my blog posts first in Word. For two reasons, one is I want to have a “hard back copy” of my posts additional to the full back-up of my blog/ site that I do regularly. And I like the (nearly) old fashioned style of typing on, what looks like, a piece of paper. Also fine tuning things, going back to old posts etc etc etc is so much easier for me, when working first in a document rather than typing directly into wordpress and having a zillion drafts floating around in the dashboard. But I babble again, so what caused the strange code to appear?

When I had finished my blog post I would copy&paste it directly into wordpress, make some minor adjustments like bold text and the like and publish it. Checking than the post in FireFox all would seem ok. Checking in Internet Explorer showed weird lines of code randomly all over the post. This lines of code are caused by Word, yep, Microsoft Word adds code to a text document without asking us! So what it the solution?

To get rid of code lines like “<!–[if !supportEmptyParas]–>”, open the post in question in edit mode, switch the view from ‘visual’ to ‘HTML’ and delete the offending bits by hand, making sure NOT to delete anything else. If you want to go down the sure-fire route, back the post up into a NOTEPAD file before making the changes.

To avoid the problem in future either write your posts in Notepad or, if you still want to write first in Microsoft Word, use the “Paste from Word” feature by clicking the appropriate symbol in your dashboard (see screenshot) and paste your text into the pop-up window and click ‘insert’.

Wordpress Dashboard marked Word insert function

Wordpress Dashboard marked Word insert function

That will get rid of the superfluous code. Hope my mistake helps you a bit 😉 One more tip, instead of asking friends and foes to check your blog/ site for you in different browsers, just use Browsershots to do the job. It is slow, but free!

PS This tip/ solution was written for use with WordPress 2.7, similar solutions might exist/ work for earlier versions of WordPress.

If you like this blog post and found it helpful, why not share it with your preferred social network? Handy links and bookmarklets above ^^^ 😉

7 comments to Not so funny problem with extra code