Bulk-delete comments in wordpress
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:
fields=document.getElementsByTagName('input');
for (i=0;i<fields.length;i++) {
if (fields[i].value=='delete') {
fields[i].checked=1
}
}
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.
March 25th, 2005 at 02:22
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.