Cleaning up Old Comment Meta Data in WordPress

After a while, old comment meta data can sometimes pile up in your database in which it can take up space as well as negatively impact your site performance. In this article, we will show you how to easily clean up the wp_commentmeta tables in your database to remove old comment meta data that no longer applies.

    1. Create a backup of your database in case anything goes wrong. This steps is critical as you are deleting content directly from your database in bulk.
    2. Log into cPanel.
    3. wordpress 01 phpmyadmin

      Within cPanel, click on the PHPMyAdmin icon within the Databases section to access the PHPMyAdmin tool.

    4. wordpress clean commentmeta 2

      On the menu to the left, select your WordPress database. If you are unsure of what database your WordPress site uses, follow our article on identifying your WordPress database.

    5. wordpress clean commentmeta 3

      Now that your WordPress database is selected, look to the top of the page and click on SQL.

    6. wordpress clean commentmeta 4

      Inside the text entry field, enter the following:

      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 );

      Then, press the Go button to the bottom right.

    7. wordpress clean commentmeta 5

      If any content was removed, PHPMyAdmin will let you know the number of rows affected. If there was not any content to remove, it will simply say that MySQL returned an empty result.

Your should now know how to easily clean up the wp_commentmeta table in your database. Following these steps regularly will ensure that the table in your MySQL database is running in top shape.

Thoughts on “Cleaning up Old Comment Meta Data in WordPress

  • <iframe width=”42″ height=”31″ src=”//www.youtube.com/embed/YFTzKgyuk9I” frameborder=”0″ allowfullscreen></iframe>

Was this article helpful? Let us know!