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. Here, I’ll discuss how to remove the SPAM comments using your MYSQL database.
I’ve written other WordPress How to guides. You may find my preventing a wordpress hack blog useful.
Table of Contents:
- WordPress SPAM Comments
- Removing WordPress Spam Comment
- Step by Step
- Other Delete Types
- Preventing Further Spam Comments
How to Remove 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.
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!
Once you’ve clicked ‘go’ this will leave you with 0 spam comments.
Other Delete Types:
DELETE from wp_comments WHERE comment_approved = ‘1’
DELETE from wp_comments WHERE comment_approved = ‘spam'”);
DELETE from wp_comments WHERE comment_approved = ‘trash'”);
DELETE from wp_comments
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.