Error message

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

Bulk Delete of Unapproved Comments in Drupal 7

  • Posted on: 13 January 2013
  • By: Pradeep George

When you allow comments in your blog post or page, often you will be spammed with thousands of comments from spammers. One way to reduse it to use module like CAPTCHA.
IF you already have thousands of comments to your posts and would like to remove all the un approved comments here is the method.

1. Enable the PHP format in your site
2. Create a new content page and add the following code

db_query('DELETE FROM comment WHERE status = 0');

3. Select your text format as PHP code
4. Save
5. Reload the page

That should run the php code and remove all the un approved comments from your database.


Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.