Clean up WordPress Meta Data
If you are using assistive technology and are unable to read any part of the HostMonster website, or otherwise have difficulties using the HostMonster website, please call 866-573-HOST and our customer service team will assist you.
Skip to main content

HostMonster Web Hosting Help

Clean up WordPress Meta Data

Overview

This article will explain how to clean up meta data in a WordPress database.



Backup your database before performing any of the steps in this article. You will be deleting data from the database. Accidentally deleting the wrong information may require restoring your database from a backup. If you are unsure how to backup your database please see How to Backup a MySQL Database

What You Need

To complete this tutorial, you will need to the following information:

Open The Database in phpMyAdmin

  1. Login to your account at my.HostMonster.com
  2. Click Hosting at the top of your account.
  3. On the cPanel, under Databases, click phpMyAdmin
  4. Log in with your cPanel username and password.
    The phpMyAdmin login.
    The phpMyAdmin login.
  5. On the left side, click on your wordpress database.
    Selecting a database in phpMyAdmin.
    Selecting a database in phpMyAdmin.

Remove Rows With No ID

  1. Note the prefix attached to your database tables. In our example database, all table names begin with wp_rfrz_. This is our database prefix. Yours will differ.
    The Database table prefix.
    The Database table prefix.
  2. Click on the SQL tab.
    The SQL tab.
    The SQL tab.

Comment Meta Data

These steps explain how to clear the comment meta data.

  1. Copy and paste this code into the textbox:
                  SELECT * FROM your_prefixcommentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM your_prefix_comments );
                  DELETE FROM your_prefix_commentmeta WHERE comment_id NOT IN ( SELECT comment_id FROM your_prefix_comments );
                  SELECT * FROM your_prefix_commentmeta WHERE meta_key LIKE '%akismet%'; 
                  DELETE FROM your_prefix_commentmeta WHERE meta_key LIKE '%akismet%';

  2. Replace your_prefix_ with your database prefix.
  3. Click the go button.
    The phpMyadmin SQL page.
    The phpMyadmin SQL page.

Post Meta Data

These steps explain how to clear the post meta data.

  1. Copy and paste this code into the textbox:
                SELECT * FROM your_prefix_postmeta pm LEFT JOIN your_prefix_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
                DELETE pm FROM wp_postmeta pm LEFT JOIN your_prefix__posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;

  2. Replace your_prefix_ with your database prefix.
  3. Click the go button.
    The phpMyadmin SQL page.
    The phpMyadmin SQL page.

Optimize The Post and Comment Tables

  1. At the top of phpMyAdmin, click the structure tab.
    The structure tab.
    The structure tab.
  2. Select the comments, commentmeta, posts, and postmeta tables.
  3. In the drop down menu labeled With Selected, choose Optimize Table.

The tables should now have unnecessary meta data removed. If you encounter any issues with the website after this procedure, consider restoring your database using your backup.

Knowledgebase Article 131,442 views bookmark tags: wordpress


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

This article explains how to install WordPress when Mojo is unable to create the database automatically.
Knowledgebase Article 196,751 views tags: MOJO automatic database install wordpress

This article explains how to find the database in use by a WordPress site.
Knowledgebase Article 326,094 views tags: database find wordpress

If you have a WordPress blog hosted on WordPress.com, you can easily export it and import it to WordPress that is installed on your hosting account with hostmonster. Login to the WordPress Data
Getting Started Article 698,906 views tags: blog export file import wordpress

Related Help Content

This article will explain MySQL database and user creation and deletion, and explain how to assign a user to a database.
Knowledgebase Article 870,620 views tags: creation database mysql

This article will explain how to change your WordPress Urls
Video "How-to" Tutorial 329,012 views tags: login temp troubleshooting urls wordpress

This article will explain how to change the Site URL or Home URL setting in WordPress. This may be useful if you have moved your WordPress site or are planning to move your WordPress site.
Knowledgebase Article 272,505 views tags: home site url wordpress wordpresstools

This article will explain how to login to a WordPress site using WordPress tools.
Knowledgebase Article 205,411 views tags: login wordpress wordpresstools

This article will explain why you see "Your WordPress site appears to be infected with malware. Please update to remedy this problem."
Knowledgebase Article 196,154 views tags: malware wordpress wordpresstools

This article will explain how to login to a website created with WordPress.
Knowledgebase Article 638,474 views tags: access admin change dashboard edit login site wordpress

This article will explain how to change the password for a database in the event that the original password is lost.
Knowledgebase Article 260,771 views tags: database mysql password

How to manually migrate a WordPress site, not using ManageWP.
Knowledgebase Article 439,513 views tags: export import migrate wordpress

This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here