Batch deleting all spam or unapproved comments with the WordPress WP-CLI

Delete all comments listed as “Spam”

wp comment delete $(wp comment list --status=spam --format=ids) --force

Delete all comments listed as “Pending”

wp comment delete $(wp comment list --status=hold --format=ids) --force

Leave a Reply

Your email address will not be published. Required fields are marked *

Markdown is allowed in comments.