Delete all WordPress Comments How To Guide
How To Guide Tutorial

How To Delete All Spam Comments From WordPress

Introduction

The Bulk Removal of the SPAM comments from your WordPress blog can be time consuming. Unfortunately in the admin panel there isn’t a select all option when looking at the comments.

There is a bulk option but that doesn’t let you remove all spam comments at once. So let’s take a look at how to get rid of spam comments on wordpress.

Fortunately there are a couple of different ways to remove the SPAM comments.

So let me guide you with this step by step tutorial on how to delete all of the spam comments from your WordPress blog.

Table of Contents:

  1. WordPress SPAM Comments
  2.  Removing WordPress Spam Comment
  3.  Step by Step
  4. Other Delete Types
  5. Preventing Further Spam Comments

How to Delete Spam Comments From WordPress

There are two certainties in life, paying taxes and Spam comments on your WordPress blog. The good news is that by using WordPress as your blogging platform you have some incredible tools already built in to prevent Spam comments from ever being seen by your readers.

All current supported versions of WordPress come bundled with a great plug-in called Akismet Anti-Spam. This plug-in has been around since 2005 and it blocks over seven million spam comments per hour! The stats are crazy!

Askimet Anti-Spam does look at the comments marked as spam to learn and improve the way it identifies comments. I haven’t seen any adverse affect to the plugin by removing all of my spam comments on a regular basis.

I’ve been asked ‘Why is my site getting spam comments?’ in the past. The answer to this lies firmly in the ‘black hat’ SEO world. People will create bots that go off and post spam comments on blogs to improve a websites search engine page ranking. If a lot of links point to a web page, search engines think that that particular page is important and will show it higher in the results pages. Blackhat practices like this are largely redundant.

Bulk Remove SPAM Comments 

Fortunately it’s fairly straight forward. To remove those un-wanted comments all at once we’re going to be writing a query and executing it using your MYSQL database. To achieve this you need to make sure you have access to your database. Make sure to backup your database before running any statements. You don’t want the headache of not having a decent MYSQL database backup if you accidentally delete everything! If you aren’t sure how to take a MYSQL database backup check out this article.

Suggested Reading:

Security should also be a concern for a WordPress blog owner. You may find my preventing a wordpress hack article useful.

Step by Step

1. Login to your server. In this example we are logging in using CPANEL.
2. Search for PHPMYADMIN.
3. Once PHPMYADMIN has loaded, on the left hand side you can select your database. Expand it to see the tables.
4. Select comments to query not just the spam comments but every comment on your blog.
5. Write the following query: DELETE FROM `wp_comments` WHERE comment_approved = ‘spam’
6. Click ‘go’
7. Go back to your admin panel and check your spam comments, you’ll see they say 0!

Select PHPMYADMIN
Select PHPMYADMIN
Select your database.
Select your database.
Select Comments.
Select Comments. As you can see from this example there is alot of spam!
Delete all WordPress Comments via MSSQL
Delete all WordPress Comments via MSSQL

Once you’ve clicked ‘go’ this will leave you with 0 spam comments.

Other Delete Types:

Delete all un-approved comments:
DELETE from wp_comments WHERE comment_approved = ‘0’
 
Delete all approved comments:
DELETE from wp_comments WHERE comment_approved = ‘1’
 
Delete all spam comments:
DELETE from wp_comments WHERE comment_approved = ‘spam'”);
 
Delete all comments in trash:
DELETE from wp_comments WHERE comment_approved = ‘trash'”);
 
CAUTION: Delete all comments:
DELETE from wp_comments

 

 

BONUS:

I’ve included an embedded video. If you struggle to follow onto this guide the YouTube video should help you.

Preventing further Spam Comments

Prevention is better than cure they say. So, with that in mind be sure to check out this article about how to prevent further spam comments.

2 Comments

  1. Hi there! Do you use Twitter? I’d like to follow you if that would be okay.

Leave a Comment

Your email address will not be published. Required fields are marked *

*