Fixing The WordPress angle bracket problem
Like much of the civilized world, I chose WordPress for my blogging software. All in all, it really is easy to set up and maintain and I’ve had little trouble with it. However, when I recently upgraded to the latest-and-greatest version 2.7, the proverbial manure hit the fan.
To make a somewhat long journey short, there is some sort of bug in newer versions of the libxml2 library that WordPress 2.7 doesn’t like. It’s technically a libxml2 (and maybe PHP) problem, but it manifests itself when using 3rd party software (like Windows Live Writer or iPhone) to update your WordPress blog via XMLRPC. The sum of the problem is that all angle brackets are stripped from the HTML of the post…so this:
<bold>stuff</bold>
becomes this:
boldstuff/bold
when it hits the database. This renders the 3rd party apps useless (unless you don’t want to have any html tags!); you have to use the WordPress backend.
So far, the official WordPress “fix” for this problem is to either roll back to an older version of libxml2 on your server, OR update to the latest version of libxml2 and a nightly build of the current “beta” version of PHP. Since the problem isn’t technically in WordPress, but is rather in supporting software, they’re not inclined to fix it. Well, that’s great, but that position pretty much screws all of us who are on shared hosting–we can’t upgrade or downgrade server software. Thanks for the support!
Luckily, one hardworking fellow figured out how to modify a few WordPress files to get things working again. If you’re not comfy with editing the code yourself, another fine gent whipped up a diff patch to make the changes for you.
The instructions for the diff patch include a command that is meant (naturally) to be run on the server, which once again disses the shared hosting crowd, who generally don’t have command-line access to their server, either. However, in this case all is not entirely lost…if you have access to a linux machine, that is.
To apply this patch (rather than hand-edit the code), I simply got on Ye Olde Linux Box and did the following:
- Download the diff patch to a temporary folder
- Create a “wp-includes” subfolder in the same folder
- Retrieve the files in question via FTP (/wp-includes/rss.php and /wp-includes/class-IXR.php) and store them in the “wp-includes” subfolder
- Open a command prompt, navigate to the temp folder that the diff patch is stored in, and issue the suggested command: patch -p0 < wordpress-xmlrpc.diff
- Once the patch is complete, re-upload the two patched files back to their proper place on the web server (it’s a good idea to back up the original files, just in case!)
Once you do that, you’re back in the 3rd party blogging business; my Live Writer works just fine now.
It worked for me, and hopefully it’ll work for you, too. Of course, you can just edit the files by hand; if you don’t have a linux machine available, I guess you’ll have to (unless someone can suggest a Windows command similar to Linux’s “patch”). Just be very careful and watch your quotes, as they can be sassy! Do also note that the diff patch does not fix the Blogger tie-in files, as the author doesn’t use Blogger. If you want to fix that, you’re back to hand-editing according to the original guy’s instructions.
February 9th, 2009 at 11:08 am
Then the big question is, “Why bother moving to the new WordPress?”
February 9th, 2009 at 12:09 pm
Well, I guess the only answer I can give is to read the change log for v2.7 and see if anything interests you:
http://codex.wordpress.org/Version_2.7