Don’t call me DOM

2 November 2004

Bulk-delete comments in wordpress

Filed under:

As many others, I’ve recently been receiving plenty of spammy comments on my blog; all of these are queued for moderation by default, but even that get a bit painful when flooded with moderation messages in my inbox, and having to delete individually each message. Even the bulk delete command in WordPress doesn’t allow you to delete all (or most of) the comments at once.

I got around the moderation flood in my inbox using yet another procmail rule, and got around the second part using a small bookmarklet, which runs the following javascript code:

for (i=0;i<fields.length;i++) {
  if (fields[i].value=='delete') {

In other words, find all the input elements, and if they have a value set to delete (the current convention in my WordPress version), mark them as checked; only needs to push the moderate button afterwards. Of course, this works well only if you receive mostly spam (as in my case) compared to real comments.

One Response to “Bulk-delete comments in wordpress”

  1. dom Says:

    With wordpress 1.5, not only is spam no more a problem, but even when it is, the “mark all” function is now a feature of the moderation board.

Picture of Dominique Hazael-MassieuxDominique Hazaël-Massieux ( is part of the World Wide Web Consortium (W3C) Staff; his interests cover a number of Web technologies, as well as the usage of open source software in a distributed work environment.