Through the preceding SQL statement, we can clearly understand that the wordpress comment table is wp_comments, and the comment_approved is the comment response field.
Comment_approved is equal to 1: Review comments
Comment_approved equals 0: comment to be reviewed
Comment_approved equals to trash: Comments from the recycle bin
Comment_approved equals to spam: spam comments
The details are as follows:
Method 1: delete pending comments, spam comments, and recycle bin comments.
The code is as follows: |
Copy code |
Delete FROM 'WP _ comments' WHERE 'Comment _ approved 'not like '1 & prime; |
Method 2: delete only pending comments
The code is as follows: |
Copy code |
Delete FROM 'WP _ comments' WHERE 'Comment _ approved' = '0 & prime; |
Method 3: delete spam comments only
The code is as follows: |
Copy code |
Delete FROM 'WP _ comments' WHERE 'Comment _ approved' = 'spam' |
Method 4: delete only the recycle bin comment
The code is as follows: |
Copy code |
Delete FROM 'WP _ comments' WHERE 'Comment _ approved' = 'trash' |
Today, we found another method to delete spam comments in batches.
We can download and install a Plugin plug-in-Delete Pending Comments-WordPress plug-in that can Delete all Pending Comments.
After the installation, you can see the "Delete Pending Comments" link under the wordpress background management Comments. Click this link and you will be asked to manually enter a line of words "I am sure I want to delete all pending comments and realize this can't be undone" (I'm sure to delete all comments to be reviewed) and the deleted comment cannot be restored) to delete all comments to be reviewed in batches. Note: This is the comment to be reviewed, not all comments, so old comments will still be retained (including those marked as SPAM will not be deleted ).
Use the WordPress plug-in to delete all comments to be reviewed
After entering this sentence, click the Delete Pending Comments button below to Delete all Comments to be reviewed in one click.