How To Mass Delete Comments In WordPress – Spam, Pending & Approved
With WordPress Comment Spam increasingly becoming an issue
you might find yourself with 100’s or even 1000’s of pending comments that you
then need to delete. Unfortunately, the base WordPress install only lets you “bulk
delete” pending comments page by page (i.e. 20 at a time). It is not
difficult to imagine that this would be very time consuming to do.
Let us first read some basic facts about WordPress comments.
When comments come in for your WordPress blog, they can be
one of these three categories.
1. Approved Comments:– WordPress has detected that these
comments are real comments, and has immediately approved these comments.
2. Pending Comments:– These comments pass the spam filter,
but either WordPress feels they they are some sorta “non human”, or it violates
some of the rules you have laid in the blog discussion settings.
3. Spam Comments:– If you have the very handy Akismet in
place, commented identified as spam will go direct to spam comments.
However, the issue comes when hundreds, or thousands of
comments come in and they go into your moderation queue. This means they pass
the spam filter.
If your blog is popular to any extent, you can expect to
receive a lot of spam comments. These are easy to clear. All you have to do is
to click on Comments > Spamfrom your WordPress admin page, and you can
clear them in one go, with the “Delete all Spam” button.
Before (or after) deleting the pending comments you may want to consider configuring your WordPress install to help prevent spam comments.
Fortunately, there is an easy way to Delete Pending Comments
in WordPress. In fact you have a few choices on how you go about doing it.
Deleting Pending Comments In WordPress Manually via phpMyAdmin
You can delete easily your WordPress Mass pending comments uing phpMyAdmin. To do so,
you need to follow the below steps.
1. Login to your cPanel Account and select the phpMyAdmin
in the Database section.
2. Select your database.
3. Click the SQL tab and run the following command.
DELETE from wp_comments WHERE comment_approved = ‘0’
When you run the command, you will get a pop-up box asking
for confirmation. Just click “OK”.
You can use this technique to carry out other similar tasks
with just one very minor alteration to the command used.
Mass Delete All Approved Comments In WordPress via SQL
DELETE from wp_comments WHERE comment_approved = ‘1’
Mass Delete All Spam Comments In WordPress via SQL
DELETE from wp_comments WHERE comment_approved = ‘spam’
Mass Delete All Trash Comments In WordPress via SQL
DELETE from wp_comments WHERE comment_approved = ‘trash’
Deleting Pending Comments In WordPress Manually via SSH
For those a little more technically minded and don’t mind
logging in via SSH and
using the command line it is very easy to Delete all your Pending
Comments. Just follow these instructions.
1. Log in to your website server via SSH. Some hosts will
disable this by default, but will allow access upon request.
2. Run the following command.mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e “DELETE FROM wp_comments WHERE comment_approved = ‘0’;”
If you used Softaculous, or another installer, to install
WordPress, you would have received a confirmation after the install was
complete with all the information you will need to run this command.
Otherwise, you will hopefully have made a record of it when you installed it
manually.
This command can be adapted with one minor change to carry
out other comment related tasks.
Mass Delete all Approved Comments In WordPress via SSH
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e “DELETE FROM wp_comments WHERE comment_approved = ‘1’;”
Mass Delete All Spam Comments In WordPress via SSH
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e “DELETE FROM wp_comments WHERE comment_approved = ‘spam’;”
Mass Delete All Trash Comments In WordPress via SSH
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e “DELETE FROM wp_comments WHERE comment_approved = ‘trash’;”
Deleting Pending Comments In WordPress Using A Plugin
This is probably the least technical way to delete your
pending comments in WordPress, and one of the easiest. Simply install the Delete Pending
Comments Plugin. The easiest way to install the plugin is to go to
the Plugins page in the Admin panel and then search for “Delete Pending
Comments”. The plugin we recommend is the first one listed, although you
will see several others that could be used.
Once installed, activate the plugin.
Under the Comments Menu in WordPress, you will see a
sub-menu item to “Delete Pending Comments.” Once clicked you will be
taken to the confirmation screen checking that you do indeed wish to delete all
your pending comments. To confirm you will need to type some text in the
box to confirm.
If successful, you will get a message saying “I deleted all
pending comments!”.
I hope this article helped you a lot on deleting mass comments in WordPrss. As always feel free to comment in case you need help or have
a question. Also share it to your friends.
No comments:
Post a Comment