This guide shows how you can clean up spam comments in your database in phpMyAdmin.
Note: If you want to prevent spam comments by bots on your website's comment form, we highly recommend adding captcha protection like Google reCAPTCHA.
- Step 1 - Click PHP and database settings in the one.com Control Panel
- Step 2 - Open your database in phpMyAdmin
- Step 3 - Click the comments table
- Step 4 - Delete spam comments
Step 1 - Click PHP and database settings in the one.com Control Panel
- Log in to the one.com Control Panel.
- Click PHP and database settings on the Advanced settings tile
Step 2 - Open your database in phpMyAdmin
Click the phpMyAdmin drop-down menu at the top right corner, and select the database from which you want to remove spam comments.
Step 3 - Click the comments table
In the menu to the left, click on the comments table. It has the prefix followed by _comments like wp_comments, blog_comments, etc. This is where all your WordPress comments are stored.
Step 4 - Delete spam comments
The easiest way to delete spam comments is to empty the entire table. This means that all comments will be deleted, also the legitimate ones. Alternatively, you can run queries to remove spam and unapproved comments in batches. We will show both methods, you should pick one.
Method 1: Empty the entire table
- Make sure you have opened the table that you want to empty.
- Click Operations in the menu at the top of the screen.
- Scroll down to the bottom and click Empty the table (TRUNCATE).
- Click OK in the pop-up window to confirm your action.
Method 2: Run a query to remove spam and unapproved comments
- Click SQL in the menu at the top of the screen.
- Paste the following query to remove all comments marked as spam, replacing wp_comments with the name of your comments table.
DELETE FROM wp_comments WHERE comment_approved = 'spam';
- Click Go to confirm your action.
- Repeat the same steps for the following query to remove all unapproved comments - again replacing wp_comments with the name of your comments table. Unapproved comments have not yet been published on your site.
DELETE from wp_comments WHERE comment_approved = '0';
Related articles: