How to remove junk or not useful comment meta from database tables in wordpress?

You may find it surprising that sometimes the comment meta size in database is almost near double of comments table. It happens because of junk content left in comment meta.

This can’t be removed just by deleting rows in wp_comments table in wordpress. See how to remove comments in bulk from wordpress database. You need to execute separate MySql queries in phpmyadmin to remove comment meta.

Steps or queries to remove junk comment meta:

  • Some of the comment meta values are not related to any of the comments. These are the meta associated with earlier deleted comments. To remove these meta values use below written query:
DELETE FROM wp_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM wp_comments )
  • If you are using akismet on your blog then use following query:
DELETE FROM wp_commentmeta WHERE meta_key LIKE “%akismet%”

Apr,25,2014

Comments

  1. By Adjie

    Reply

Leave a Reply

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

%d bloggers like this: