Back in September of 2004 I released a plugin that allowed you to delete large amounts of spam with one click.
Basically one afternoon I was hit with a wave of spam that resulted in 1500+ comments awaiting moderation that were all spam. That was not a fun prospect, deleting all of those comments via the admin UI. So I took a trip to the terminal and issued one command, which wiped them all out.
So taking that experience I created a plugin that allowed you to delete comments by author, IP, email or URI. Now fast forward to WordPress 1.5. 1.5 has some wonderful toosl to help you combat spam built in, a blacklist feature, moderation by keywords and so on. At first I was stoked at how well these tools were working, I didn't see any real waves of spam hitting my site, I was assuming that 1.5 was sending all that evil to /dev/null/ like a good little monkey.
I however, was very wrong.
Apparently the DEVs decided that what should happen is that anything that is considered spam will be flagged as such: 'spam' and kept in the comments table in all our databases. I still fail to see the usefullness of this, but that was not my call. The point is that I was in my DB mucking around, as I am want to do, and found that I had 1500+ "spam" comments just hanging around in my comments table, with no way to interact with them from within WP. Now for me, that really isn't a big deal, I just fire up the old terminal, or open phpMyAdmin and delete them that way. For the normal user though, that is another story.

So I being the good samaritan I am, raised a feature request bug about this, and was basically told that you should just issue the "DELETE from wp_comments WHERE comment_approved = 'spam'"; which my friends is crap. The normal user who cares about the size of thier DB should be able to easily and quickly get rid of that chaff from within WordPress.
Well now you can.
I had been meaning to update Mass Delete for 1.5 for some time. This answer from the DEVs gave me the impetus I needed to get it done. This new version serves two purposes:
You can still delete groups of spam as you did originally, only now Mass Delete only deletes from comments flagged as spam, when you are successful you see this message:

The new feature is Mass Nuke, with one click you can nuke every comment in your table that is flagged as spam, when run successfully you see this message:

Not really much to it, really. Once the plugin is activated you can find it in the Manage submenu, there will be a selection labeled Spam at the end.
Here is the file you need cjd_delete.zip. Enjoy and let me know if you find any bugs, or have any comments.
Stroll on over and visit Mike
March 1, 2007
Best. Plugin. EVER.
Seriously, it found 304 messages marked as spam in the database for one of the WordPress installations I maintain. I love it.
Stroll on over and visit Indranil
March 1, 2007
And to think that I was overjoyed to see a 'spam' marker for comments!
Well, immense thanks for the plug.
Stroll on over and visit Dougal Campbell
March 1, 2007
We flag them as spam rather than outright deleting them in order to give plugin authors (such as yourself) something to keep you busy ;)
No, seriously. I think we will eventually add something (unobtrusive) in the admin interface to let you delete them. But there is value in saving them. First of all, because some small fraction of users might want to review the data for finding false-positives. And also because the data can be used for Bayesian analysis.
Stroll on over and visit kartooner
March 1, 2007
Thanks Chris. I can't tell you how long I've been looking for a plugin like this. I appreciate your effort. :)
If you have a sliver of time, could you email me? I've got an idea for a simple Wordpress plugin and believe me, if I knew how to write a plugin (yeah, I've read the tutorial floating around the net) I'd do it myself.
Stroll on over and visit Aaron
March 1, 2007
You are a genius. Ill be trying that plugin real soon. From what I have read so far is that, this is the most awesome spam deletion tool! Great work man! Oh, and congratulations again on the parenthood!
Stroll on over and visit Michele
March 1, 2007
Another extremely useful plugin. Not that running a SQL query is big problem for me, but I'm sure it is for many...and well, this way's easier.
Thanks for being the good samaritan you are! :D
Stroll on over and visit Shawn Grimes
March 1, 2007
Great update Chris. I had forgotten about all the spam I had in my table from moderation. And now they are all gone.
All spam Nuked! Rowr! I love it!
Stroll on over and visit Svein Kåre Gunnarson
March 1, 2007
What a nice plugin - works like a charm. And here I had thought that the messages I marked as spam were deleted completely. Well - not only have you made me aware of that - you also made it easy for me to get rid of'em. Thanks! :)
Stroll on over and visit Matt
March 1, 2007
Well the answer to the bug was very targetted, because users would never know the spam existed unless they used this plugin (which I wouldn't advise) or they looked at the database. We'll never be able to have a decent bayesian filter unless we have a good corpus of ham AND spam comments.
Stroll on over and visit Chris J. Davis
March 1, 2007
Dougal,
I appreciate you guys looking out for me like this, brings a tear to my eye...I agree that there is some value to saving the comments flagged as spam, my point was that the answer I got was crap, it took me 10 minutes to adapt some of my old code to do this, I assume it would have taken you who are code-gods much less time.
The end user should never have to go to the DB or phpMyAdmin to do something. And for the record had I not been cleaning out my table via the terminal until I had this done, I would have around 3000 spam comments in my DB, and that is only since I installed whatever build of 1.5 that incorporated this, think about had I gone a year without checking my DB.
Lets just say I have been running like this for 2 months. 3,000 commments every two months becomes 3,000 X 6 = 18,000 comments that are spam. And I would have never known. This is unnaceptable from an end user standpoint.
That was my point, this should have been provided by the core, not a plugin, but what do I know, right? ;)
Stroll on over and visit seriocomic
March 1, 2007
ooh...I LOVE being an unknowing guinea-pig. Thanks Chris for your fix.
Stroll on over and visit Matt
March 1, 2007
Also, I may not agree with the plugins you make but I'll fight to the death for your ability to make them. :)
Stroll on over and visit Chris J. Davis
March 1, 2007
Matt,
Agreed, I just don't think that the way you chose to implement this is the best way. Period. But again, that is my opinion and I am able to fix what I see as a hole on my own, aint open source grand?And that my friend is why I am still here, and why I work with you to hoepfully make this a product that surpasses all expectations. I don't have a problem with the project lead not agreeing with me when I rant. ;)
Oh and get a freakin gravatar!
Stroll on over and visit Greg
March 1, 2007
Thank you Chris, thank you thank you thank you!
It's just what I've been looking for
Stroll on over and visit khaled
March 1, 2007
Yeah Matt sort yourself out, you lazy bum :). The power of open source is all too great.
Stroll on over and visit kyte
March 1, 2007
I must be the first person for it not to work :( Installation, no problem; visible in the plugins management area, no problem; clicking on the button to "nuke 'em all" sends it off to do its work. But the spam is still there. all 439 instances. :( I am guessing its a server config issue but because I have no clue regarding those things (and no control over the server config in any case) i am stumped. Everything *looks* as if its working but the spam doesnt get nuked.
any clues at all?
Stroll on over and visit Jonas Rabbe
March 1, 2007
Matt,
Well, why don't you just have a "delete spam comments silently" checkbox in the admin interface. If the box was checked the spams would be deleted, if it was unchecked the current behavior would take place. This would allow the user to decide.
Stroll on over and visit Martin
March 1, 2007
I never new all the spam comments stayed in the DB once marked as Spam, so this plugin is a revaltion! Installed and i had 394 Spam comments! Brill plugin. :)
Stroll on over and visit Niklas
March 1, 2007
Thanks! Your plug-in works wonders.
Stroll on over and visit Chris J. Davis
March 1, 2007
Thanks for the quick response.
I can admit the validity of some of your points, much better stated this time around!
I am stil l not convinced on the usefullness of a large spam/ham farm as opposed to a small, targeted one.
But time will tell, and I am willing to wait to find out.
Stroll on over and visit Mark J
March 1, 2007
The IP information is likely worthless, but the URIs are valuable, as are the keywords they use. Spam Karma 2 is going to use that information in some way. It is already useful in Spam Karma 1 (with a one line modification) to save comments as "spam" instead of dropping them entirely, because if you see a legit comment in your SK digest, it can easily be restored (using ColdForged's plugin for viewing and editing spam comments).
My use of the word "yahoo" wasn't meant to refer to people who have massive quantities of spam in their database and want to trim it down... I was more referring to a casual user who might see a "delete spam instead of saving it" option and think "heavens, I don't want to save spam!" and thus any benefit of being able to take past spam into consideration would be severely muted because of the ease with which yahoo--er, people, could disable it.
Also, I can see how a buildup of spam could be a problem in the long term (or short term if you have a massively popular site). That is a problem that needs to be addressed. There should be a limit to how many spams are stored in the database, or things will eventually get out of hand. I think I'll suggest that in Mosquito.
No snarkiness taken. And I apologize if my first comment implied that people don't have a right to the contents of their database. I don't think that at all. You absolutely have a right to it. I just think that if you put a "delete spam instead of saving it" option in there, people will opt to can the spam instead of saving it for possible future benefit. I think the best compromise is to limit the number of comments so that your concerns about database bloat are addressed, but there is enough of a spam base for anti-spam plugins to use to fight future spam.
Stroll on over and visit Chris J. Davis
March 1, 2007
I am not even sure where to begin Mark.
I am not sure what amazes me more, that you think that having a spam farm full of information that is most likely spoofed, and therefore of no real value is good, or that I and all the other users, what did you call them... "yahoos" that was it, out there have no right to the contents of our databases.
And I am not sure what kind of traffic you are generating, but I assure you that the spam comments that would be "hanging out" in my DB are like stinking rats, since I would have tens of thousands at the end of even a few months. That is unacceptable.
And I appreciate you giving me permission to delete the spam in my db, thanks for that.*edit* I don't want to be snarky, that is not my intent, I do appreciate your comment I just don't see the logic.Stroll on over and visit Mark J
March 1, 2007
I'm rather confused as to what problem this is solving. This isn't like a rat who dies in your wall and starts to stink after a few days... spam sitting hidden in your database does you no harm, and one day (rather soon, actually), it will be used to better identify blog spam. It seems to me that this appeals to the obsessive compulsive types who, now that they know spam is lurking in their database, are losing sleep. "Everywhere I turn, I can't see them, but I know they're there... I feel them watching me! Ahhhh!"
As to providing an option... and forgive me for going all Socialist on you... sometimes things need to be done in order to benefit the largest possible number of users. If you want to purge the invisible spam, more power to you, but it shouldn't be included in the core so that any yahoo can limit their spam-fighting abilities with a single click.
What he said. :-)
Stroll on over and visit Nat
March 1, 2007
sweeet it worked for me :)
Stroll on over and visit andrena
March 1, 2007
Thank you so much! Until I stumbled upon your site, I didn't have a clue that all the spam was in my database (duh!!!) Thank you again! :-)
Stroll on over and visit patrick
March 1, 2007
Worked great; thanks!
Stroll on over and visit Micah
March 1, 2007
This is the single best WP plug-in I've ever downloaded. Thanks for doing this.
Stroll on over and visit pericat
March 1, 2007
Lovely! And much less of a chore than remembering to ssh out to my host and do SQL things.
Thanks for this, as well as your many other fine contributions that make my life easier.
Stroll on over and visit Chris J. Davis
March 1, 2007
No, that should read as it does,
"Be warned this is undoable."
And as for the sorting, I am fairly confident that a valid commenter will be showing up in singles, not in multiples.
But I have been investigating how to modify the code to allow for differing sorts.
Stroll on over and visit Anton Sherwood
March 1, 2007
There appears to be a small error in the text:
"Be warned this is [missing word?] undoable ..."
Stroll on over and visit Anton Sherwood
March 1, 2007
Or possibly:
tr '\r' '\n' <cjd_delete.php >cjd_delete.php.unix; mv cjd_delete.php.unix cjd_delete.phpStroll on over and visit Anton Sherwood
March 1, 2007
Thanks!
The Unspam menu would be easier to use if it could be sorted by a column other than IP.
Stroll on over and visit Tim Hardy
March 1, 2007
Great plug-in, thank you! Worth it for the "unmark as spam" option alone.
This didn't work out of the box for me when I unzipped it under linux. The "Enable plugins" screen became garbled with the contents of the raw php file. I'm guessing this is because you developed this on a Mac which handles endline characters differently.
If anyone other linux user is having the same problem, the following converts the code to unix format:
tr '\r' '\n' cjd_delete.php.unix && mv cjd_delete.php.unix cjd_delete.phpHope this helps a few more linux newbies enjoy the fruits of your work!
Stroll on over and visit Tim Hardy
March 1, 2007
Anton is correct - apologies for the typo above in which I've somehow missed out a vital chunk of the command sequence. Thanks for correcting this.
Stroll on over and visit Anton Sherwood
March 1, 2007
Oh. How is it undoable? (And why the warning?)
Yes, a valid commenter is likely to be unique, and thus harder to spot if the sorting is effectively random. Each dummy domain tends to occupy several rows of the table with different IPs; the false positive does not stand out.
If the table were sorted on the name, it would be easier to find the one whose name is not some variant of "poker". If it were sorted on the URL, it would be easier to find the one that is not in a "dummy domain of the day".
Stroll on over and visit Jo
March 1, 2007
Excellent! Thank you so much - had no idea those peskie lumps of spam were still hanging around
All nuked!!
:)
Stroll on over and visit Logan
March 1, 2007
Excellent plugin. I didn't even know that those little spam-spawn were still in my database. Thanks!
Stroll on over and visit Michael Sarver
March 1, 2007
Much like many of the others said, I had no idea that when I marked a comment as "spam" it was still chillin' in my DB. Thanks for the plug-in! I like order...
Stroll on over and visit Oli
March 1, 2007
3333 spam comments in my db counts PHPadmin. One click with ur great Plugin and they all gone to nirvana.
Thx a lot from a german user
Stroll on over and visit Static Brain
March 1, 2007
Very handy little tool. Thanks for it. I hate spam and any invention to make it go away easier is dearly loved. :-)
Stroll on over and visit Natasha
March 1, 2007
Wow! I've just installed this. I've just recently started getting stupid spam comments from online poker and all that shiznay, and phpadmin is a bit screwwy on my computer. Thank you for making this, I'm a bit of a newbie, so this is UBERhelpful!
Stroll on over and visit Jonathan
March 1, 2007
I take it this works OK with Wordpress 2.0.x? I hope so as I've just nuked 45 spam comments with it! I really don't want those cluttering up my database. Thanks for the plugin.
Stroll on over and visit Andy
March 1, 2007
I just wanted to say thank you for a brilliant plugin. Effective, simple, easy to install and make use of.
Stroll on over and visit Whitesox
March 1, 2007
Absolutely gorgeous plugin......
Stroll on over and visit Gloups
March 1, 2007
Thank you for this plugin. I'm sure it will help me !!
(Sorry for my bad english : I'm french :-p)
Stroll on over and visit bill
March 1, 2007
I keep getting this error when trying to delete all spam comments:
Cannot load cjd_delete.php
Stroll on over and visit Jamie
March 5, 2007
Great tool - I also has no idea that they left the comments in the db, I assumed they sent a short id or something to some spam database somewhere and then deleted it. I too do not understand why they would leave it in the db withoout giving the user an option to delete it as well. Thanks again!
Stroll on over and visit Joe
November 18, 2007
I have a blog with 30,000+ spam comments. When I click on the spam item in the manage toolbar, the connection times out.
I'm guessing this is probably because of all spam. Is there a setting somewhere that I can change so it doesn't time out, either on my browser, or on the server (I have root access).
Stroll on over and visit Cori
April 18, 2008
Worked like a charm on 5762 spams ... plugged into WP 2.5 perfectly. Rowr indeed!
Stroll on over and visit Mike
June 8, 2008
Thanks a lot for this saviour, Chris. Plugged into WP 2.5.1 perfectly and deleted all the spam that was accumulated in a flash.