Skip to content
December 18, 2008 / Upnishad

How to remove all comments from WordPress.

As you can see that I hardly blogged for last 4 months. When I logged in to my WordPress console today, I found around 50k comments – most of them spam. Its not humanly possible to delete all of them manually.

The best way of getting rid of a bunch of un-approved comments from WordPress is to manually remove from the database. Please backup your database before you use this technique.

First, go into phpmyadmin and select the database wordpress is using, and hit the SQL tab.

Execute the following query in the SQL section of phpmyadmin

SELECT * FROM wp_comments WHERE comment_approved =’0’

This this will output a number. Make sure this is the exact same number as the amount of pending comments you have in the wordpress admin panel. It should be. If it isn’t you have some serious problems which I can’t help you with.

Now that we have isolated the pending comments, time to delete them all. Go back into the SQL section and enter this command

delete from wp_comments WHERE comment_approved =’0’

You are done.

Advertisements

5 Comments

Leave a Comment
  1. Milo Felipe / May 31 2009 10:00 pm

    Hi. Thanks for this tip. I think what you meant was “SELECT count(*)…”.

  2. Christian Ries / Oct 10 2009 6:38 pm

    Thanks it works great, just the right single quotation marks were not correct, here the functioning code:

    SELECT * FROM wp_comments WHERE comment_approved =’0′

    delete from wp_comments WHERE comment_approved =’0′

  3. PhillDoc / Oct 22 2009 2:23 am

    Cool blog you got here. I’d like to read something more concerning that matter.

  4. Settor33 / Oct 22 2009 4:46 pm

    Anything that pleases a doomer. ,

  5. Faggot50 / Oct 23 2009 3:55 pm

    The needs are ideological rather than sexual, but the effect is the same. ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: