General Topics

How To Delete Spam Comments In WordPress?

Delete Spam Comments In WordPress

Delete Spam Comments: If you are worried due to spam comments in huge quantity in WordPress then be patience you can delete spam comments in WordPress using CPanel. A big quantity of spam comments effects on your website speed. So it’s better to delete spam comments in WordPress using phpMyAdmin. If you want to delete spam comments manually without any installation of the plugin then WordPress delete all spam comments by phpMyAdmin is the best way. You can also use WordPress spam comments blocker like Disqus, Akismet. Here you will be able to remove spam comments from WordPress by entering in your database. If you want to minimize the size of spammers then you can also use some option from discussion tab like shown below.

Delete Spam Comments In WordPress

Just go Setting » Discussion.

Disuccsion Tab

Now do the setting like shown below.

Discussion Setting

Spam comments removing process will optimize your database and make your site faster. I will suggest using bit quantity of plugins because your site speeds effect due to these. You can improve your database using some simple codes. You can read here a published article about it How to Repair And optimize SQL database performance Of WordPress?

If you block spammers then you also get a lightweight database and when your site database doesn’t contain garbage then obviously it will work smooth.You can read how to stop spammers with the help of security plugins The best security plugin nowadays. The security plugin block spammers and hackers. If you want to disable comments in WordPress then don’t forget to read WordPress Spam Comments Disabled  Let’s see how to remove spam comments using phpMyAdmin?

Now run these queries.

If you want to remove approved comments.

SELECT *
  FROM wp_comments
  WHERE comment_approved = '0';
DELETE
  FROM wp_comments
  WHERE comment_approved = '0';

If you want to remove spam comments.

SELECT *
  FROM wp_comments
  WHERE comment_approved = 'spam';
DELETE
  FROM wp_comments
  WHERE comment_approved = 'spam';

How To Remove Spam Meta Data From WordPress?

Now the turn to remove WordPress comments Spam metadata.

If you want to delete all.

SELECT *
  FROM wp_commentmeta
  WHERE comment_id
  NOT IN (
    SELECT comment_id
    FROM wp_comments
  )
DELETE
  FROM wp_commentmeta
  WHERE comment_id
    NOT IN (
      SELECT comment_id
      FROM wp_comments
    )

Now next step if you are a user of Akismet. Run the below query.

SELECT *
  FROM wp_commentmeta
  WHERE meta_key
  LIKE "%akismet%"
DELETE
  FROM wp_commentmeta
  WHERE meta_key
  LIKE "%akismet%"

You can also change Akismet spam comments deletion interval. Akismet removes spam comments metadata after 15 days but if you want to minimize the time then you can edit your function.php file and add this code.

add_filter( 'akismet_delete_comment_interval', 'saotn_set_akismet_delete_interval' );
function saotn_set_akismet_delete_interval() {
  return 2;
}

Note: Keep in mind before running these queries backup your database. Maybe these codes harm your database. You can read here How to backup SQL database of WordPress?

20 Link Building Techniques for 2017

How To Make A Sitemap For A Website? With Screenshots

How To Access Function.php File In Just 2 Minutes

Show More

Global Blurb Team

“Global Blurb since 2015” Global Blurb providing information about SEO, Beauty, Health & Fitness, Interior designing, Fashion and ways of earning online without investing a penny. The blog designed to share ideas about different topics.

Want to contribute