How to delete all pending comments in WordPress
October 30. 2020
WordPress is one of the most popular content management systems, today. Approximately, every third website you visit each day is a WordPress website. With this in mind, you can assume that millions of people are leaving comments on those websites on a daily basis. At the end of the day, someone has to manage all the content, including those numerous comments. If you are one of the moderators, you know how difficult it can be sometimes. Especially if you are just starting. Fortunately, there are several ways to easily manage and delete all pending comments in WordPress. Which are quite useful because moderation can sometimes be time-consuming.
A couple of ways to delete all pending comments in WordPress
Generally, comments are an important way of communicating with the audience. With comments, people publicly exchange opinions, share advice, and ask for additional info from the website moderators. It’s a valuable part of a good user experience and a good way to easily improve your website overall. In all its usefulness, managing the commenting sections require some extra effort. If you have thousands of pending comments or spam that you need to delete, you can try some of these methods.
The manual method with default WordPress configuration
WordPress websites, like many others, require proper maintenance. This means you need to manually change plenty of default configurations. For comments, the default configuration is already set to filter a large portion of the comments. But it doesn’t always do exactly what you hope to do. Sometimes, comments that should find a place in spam slip through the filters and end up in the pending section.
A built-in “Empty Spam” is a convenient one-click-solution to delete all the spam messages. But, it’s a bit different when you need to delete pending comments.
By default, in your comments>pending sections, you can see only 20 comments per page. For this reason, you can only delete a specified number of comments at once. Deleting all the pending comments this way can be atrocious. But, you can increase the number of comments you see to 999. Go to “Comments” on the left bar, then select “Screen Options” on the top right side of the screen. There, you can enter the number of comments per page.
Otherwise, if you have several thousand comments, you should better try other methods.
Using plugins to delete pending comments
Another way to delete all the pending comments in WordPress is to use plugins. There are numerous plugins that can help you with your comments management. Here are some of the most popular:
- Delete Pending Comments – this plugin offers a fast way to delete all your spam and pending comments. Wonderful plugin to battle against spam attacks.
- Delete All Comments of WordPress – this plugin is built to deal with all approved and pending comments with one click.
- WP Bulk Delete – you can delete comments, posts, pages, and other data in bulk with this plugin. It also has powerful filters that help you choose what you need to delete.
- Delete Comments By Status – you can delete all the comments by choosing their status, including spam, pending, approved, and trashed comments.
- WP-Sweep – offers to delete using default WordPress delete functions, without direct MySQL queries.
All of them have their own specific way to deal with pending comments issue. And the best way to decide which one suits you the best is to install and try them.
Use SSH to deal with comments
This is a good solution for people who prefer a more technical approach. You can log in via SSH and use a command line to deal with all those pending comments. The point is to execute a set of commands after you log in to your website server with SSH.
Once you are in, run the next command:
mysql -uDB_USERNAME -pDB_USER_PASSWORD -DYOUR_WORDPRESS_DB_NAME -e "DELETE FROM wp_comments WHERE comment_approved = '0';"
In particular, this command deletes all non-approved comments that we see as pending. Just don’t forget to add your own username, password, and database name instead of generic names.
You can also change the last part of the command to execute other tasks:
- to delete all approved comments in WordPress: comment_approved = ‘1’
- delete all spam: comment_approved = ‘spam’
- delete all trash comments: comment_approved = ‘trash’
On a side note, be careful with comment_approved = ‘1’ because you don’t want to delete something you need to keep.
Use phpMyAdmin for deleting
Another way to delete pending comments is with phpMyAdmin. You need to login to cPanel and then choose the phpMyAdmin in the database section. Once inside, choose your database. There is a tab where you can enter the next commands:
DELETE from wp_comments WHERE comment_approved = '0'
Just like with SSH, you can change the command line to delete different types of comments.
Delete comments with a plugin that executes SQL commands
You can use SQL commands to delete spam and pending comments in just a second. If you are not familiar with SQL, this plugin can help you. SQL Executioner allows you to run commands for your website from the Admin interface.
Here is a list of commands:
DELETE FROM wp_comments WHERE comment_approved = "0"
– deletes pending comments
DELETE FROM wp_comments WHERE comment_approved = "spam"
– to delete spam
Make sure to regularly backup your database in case you delete something you didn’t want.
How to prevent future spam and piles of pending comments in WordPress?
One way to block a portion of unwanted comments is to add a list of keywords to your Comment Blacklist. Go to Settings>Discussions, enter keywords into the blacklist section, and save.
Another way is to set you WordPress discussion settings differently. Go Settings>Discussion and see what options suit your needs. By all means, make sure that your comments are manually approved to prevent spam of your comment section on the live website.
A popular and, for many, the inevitable solution is the Akismet Spam Protection plugin. In general, it checks comments and prevents spam and other malicious content from being published. Once you configure it to your appeal, make sure to regularly update it for full efficiency.
If you have problems with managing comments on your website, these are useful ways to deal with and delete all pending comments in WordPress. Without restriction, you will be able to handle large amounts of unnecessary comments with just a few clicks. In essence, it will save you a lot of valuable time and make the entire maintaining process much friendly.