Loading...

Knowledge Base

How to Clean Metadata: Simplifying WordPress Database Cleanup

Cleaning up your WordPress metadata helps keep your website fast, organized, and SEO-friendly. Over time, unnecessary metadata can build up in your database, slowing down performance. This guide will show you how to clean WordPress metadata safely using phpMyAdmin, including removing unused rows and optimizing your post and comment tables for better site speed.

From time to time, optimizing the database to improve site performance for your visitors is essential. This article will explain how to clean WordPress metadata.

What You Need

To complete this tutorial, you'll need to know the following information:

  • Before you get started:
    Back up your database before performing any of the steps in this article. You'll be deleting data from the database. Accidentally deleting the wrong information may require restoring your database from a backup. If you need help with how to back up your database, please see our article on how to back up a MySQL database.
  • The username and password to your Bluehost account.
    Need help logging in? If you need help or a refresher, this guide will show you How To Log in To WordPress Sites - WP Admin Access.
  • The name of your WordPress database. If you don't have this, please see our article on how to find your WordPress database.

How to Open the Database in phpMyAdmin

  1. Log in to your Bluehost Account Manager.
  2. In the left-hand menu, click Websites.
  3. Click the MANAGE button located next to the website you want to manage.

    Bluehost Account Manager - Website Manage button
     

  1. In the OVERVIEW tab, click the PHPMyAdmin button.

    am-php-my-admin-1
     

  2. Along the left-hand side of the screen, click on the database associated with your WordPress installation.

    phpmyadmin-tables-sample
     

How to 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.

    phpmyadmin-tables-sample-2
     

  2. Click on the SQL tab.

    phpmyadmin-tables-sample-sql
     

Comment Metadata

These steps explain how to clear the comment metadata.

  1. Copy and paste this code into the textbox:
  2. Replace your_prefix_ with your database prefix.

    phpmyadmin-tables-sample-3
     

  3. Click the Go button.

Post Metadata

These steps explain how to clear the post metadata.

  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.

How to Optimize The Post and Comment Tables

  1. At the top of phpMyAdmin, click the Structure tab.

    phpmyadmin-tables-sample-4
     

  2. Select the comments, commentmeta, posts, and postmeta tables.

    phpmyadmin-tables-sample-5
     

  3. In the drop-down menu labeled With Selected, choose Optimize Table.

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

Summary

Cleaning your WordPress metadata regularly helps your database run better and improves your website’s performance. To remove unused data and optimize your tables for better SEO and speed, follow these steps in phpMyAdmin. Always back up your database before making changes to ensure a safe and smooth cleanup process.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Loading...