No, I don’t hate qTranslate! As a matter of fact, I quite like the plugin. But sometimes, oh my, it needs to be removed!

And there is the pain. Quite a lot of it, actually. qTranslate just doesn’t clean the database after itself. And imho it really should. I mean, it’s not like most plugins that have a few rows in wp-options table, or even a separate table just for it. qTranslate messes with the actual content. Bigtime.

For example, a translated content might look like this:

<!--:en-->Hi<!--:--><!--:fr-->Salut<!--:--><!--:ru-->Привет!<!--:-->

(taken from http://deyneko.com/internet/qtranslate-vs-wpml/, check it out for a nice comparison between qTranslate and the other most used multi-language plugin for WordPress – WPML).

Now that’s a clever way to handle languages. The <!–:en–> is actually a HTML comment (the text of this comment is “:en”). When this content has to be printed out to the world, qTranslate checks which language is currently active and strips all content but the selected language.

But what happens when qTranslate is uninstalled? Nothing, and that’s the problem. WordPress happily prints out the entire content. HTML comments are not visible to the user browsing our site, so she would see “HiSalutПривет!” Not very nice…

There seems to be no other choice than to “manually” purge all the content on the database level, leaving only one language. to be fair, there is one other option: to create of a PHP “script” that would go trough each post while qTranslate is still active and strip it clean using qTranslate’s own functions. It’s doable, but the (My)SQL approach seemed quicker at the time. So, without further ado, here are the queries that work fine for me.


View the code on Gist.