Fix the Windows Live Writer and WordPress stripping tags issue

I’ve been using Windows Live Writer to write posts for several months now. This has primarily been for my blog posts at Weblog Tools Collection. I decided to start using WLW for Techtites and

I was able to add both the blogs properly and made my first blog post. Uploaded the post to my website and noticed gibberish. On closer observation, I realized that the < and > were stripped out completely. As a result, code like <p><a href="">Techtites</a></p> became pa href=""Techtites/a/p. I manually had to edit the post to correct this post. I noticed the problem at both the blogs which are running WordPress 2.7. I initially suspected this to be the reason, and so decided to search.

Came across this article by Joseph Scott. Joseph is one of the developers of WordPress. He writes:

A gradually growing list of people have run into a very odd problem using XML-RPC methods in WordPress, where the left angle bracket ( < ) gets stripped. There’s been a fair bit of discussion about this on ticket #7771. The bottom line: the behavior of the PHP XML extension when built against newer versions of libxml2 changed, such that left angle brackets get stripped when parsing XML.

There’s been some back and forth between libxml2 folks (email list) and the PHP folks (bug 45996), with no real solution for those using the tainted versions of libxml2. So what are your options if you’ve got this problem?

There are currently two solutions to this problem.

  1. Downgrade to a lower version of libxml2. v2.6.30 has been known to work.
  2. Build PHP with expat parser instead of libxml2

Unfortunately, both solutions require you to have root access to your server. If you don’t you can write to your host and point them to this solution.

I decided to go ahead with option 1. Codehead has a good tutorial on downgrading to libxml v2.6.30 for users running cPanel. Non-cPanel users can check out the tutorial by Pete.

The procedure is rather simple. All I had to do was copy-paste the code into the Linux command prompt, edit two files and I was good to go. It’s been running fine for nearly a week now.

If you don’t have root access, you’ll have to just wait it out before the libxml2 and PHP folks sort their differences out!

Update: has published a possible fix by editing three WordPress files. I haven’t tested this out myself. If any of you try it let me know. The following code has been added to the files:

//xmllib 2.7.0 -2.7.2 stripping leading angle brackets bug patch
if(LIBXML_DOTTED_VERSION == '2.7.0' ||
$xml =str_replace("&lt;","&lt;",$xml );
$xml =str_replace("&gt;","&gt;",$xml );
$xml =str_replace("&amp;","&amp;",$xml );
//end Fix

I’ve modified the files myself and made them available for you. Download the zip and extract the files in your WordPress 2.7 root directory. The zip file maintains the necessary directory structure, so zipping in the root directory is sufficient. The files should work with only WordPress 2.7 and are not meant to be installed on any other version.

Update: Users have reported mixed results with the attached fix. It works for some and doesn’t for others. If it’s not working for you check if the files have been uploaded in the right place. Alternatively, try making the changes manually as listed in the tutorial by Hoofoo.

Download WordPress 2.7 XML Strip-tag from DivShare [25KB]


20 thoughts on “Fix the Windows Live Writer and WordPress stripping tags issue”

  1. Hi.
    I download de zip and descompress. Later upload by ftp in the directory corresponding.

    I test with windows live writer and Scribe Fire (firefox plugin).

    My site is new, work in wordpress 2.7.

    You helpme?


  2. I tried this fix also. It actually did nothing on my site. I use Windows Live Writer with the Ink Blog plugin. What happens for me is I send the post to publish and I get a huge chunk of \”stuff\” that I assume would actually be my ink blog post if it worked. I tried the workaround last night and nothing actually happened. I then had a friend modify the files (I had no idea these files I downloaded were actually the ones from hoofoo) according to hoofoo and my site broke. Luckily it’s back but I’m still not able to post ink blogs directly. I unzipped the files (when I tried this fix) and placed them in the appropriate directories via ftp . What a shame. My host doesn’t want to downgrade the lib so I am hoping that at some point in the future a viable solution can be found. Thanks for putting the files together though!

    1. Guess, this isn’t really a working solution.

      It is really hard to actually find a host who will downgrade software, especially since this does require a good deal of work on their part.

      I guess it is wait until a truce is reached! 🙁

  3. Ajay,

    I’ve downloaded your zip file, uncompressed it, uploaded the files to my server in the appropriate folders and haven’t had any luck with it. Have I missed something? I’m on a shared host so restarting PHP/Apache isn’t an option.

    1. Hi,

      Can you manually modify the files with the code above or directly from the link and give it a shot. I’m not in a position to verify currently, simply because all my blogs reside on the same server where I downgraded libxml

      1. Ajay,

        Yes, I’ve manually updated the files and uploaded them as well, still no luck. My host was even gracious enough to recompile PHP 5.2.8 with LibXML 2.7.3 and that didn’t do it. Supposedly this is fixed in PHP 5.2.9 with LibXML 2.7.3 so it sounds like I’ll just have to wait until the next build of PHP is available for my host to recompile.

  4. Hi ,,,

    I just shifted my blog to another host … when i post via live writer i get this problemm ,,, its weird . ..

    can we have a fix for 2.8.1 version ..

    anil chopra

  5. thanks for posting. the hoofoo solution did the trick for me.
    i’m running whm/cpanel on redhat.

    happy new year!

Leave a Reply to MGD King Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.