Tag Archives: wordpress

Removing SPAM Comments From Old WordPress Exports

When it came to migrate my blog from an older installation of WordPress to the latest version on WordPress.com, I had a problem. The content export was 20Mb, but the limit was 15Mb. The cause was obvious – SPAM comments had filled up the old one (even though marked as SPAM, they are still exported), and until recently there has been no way other than modifying the database to get rid of them entirely. I had hoped to do that from the new system, but I couldn’t get past square one.

To resolve this, I put together this XSLT to remove SPAM comments from your WordPress exports:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:wp="http://wordpress.org/export/1.0/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns="http://www.w3.org/1999/xhtml">
  <xsl:template match="//wp:comment&#91;wp:comment_approved = 'spam'&#93;">
  <xsl:template match="//content:encoded">
      <xsl:value-of select="." disable-output-escaping="yes" />
  <xsl:template match="*">
      <xsl:copy-of select="@*" />
      <xsl:apply-templates />

Unfortunately, I had to manually go and fix some malformed comment HTML (or in the case of SPAM, just delete it) for it to work, since the XML wouldn’t even parse, but once that was done the result worked perfectly for the import. Then it was just a matter of cleaning up old blog links and some HTML that didn’t look quite right in the new template by searching within WordPress.

I hope someone else finds this useful!

Blog Moved to Exist, and WordPress

Since DevZuz was acquired by Exist , I’ve now move my blog to it’s new home. Hopefully everything redirects here now, and I’ll shortly set up Feedburner properly (finally) so that can be used to subscribe in future. I’m really liking WordPress – though Pebble treated me well, you just can’t go past the wealth of plugins that WordPress offers.

You’ll find some other DevZuz bloggers here too – as well a growing number of others from Exist.

It’s been a crazy busy start to the new year, so things have been a little quiet on this blog. I’ve spent most of my time in January in the Philippines, settling in to the new environment and having a blast with my friends and coworkers from Exist.

I’ll post some more separately on what’s been happening and what’s coming up!