How To Clean Meta Data In A WordPress Database

How To Clean Meta Data In A WordPress Database

MetaData is a data that gives information on other data elements. It gives information on the data that is contained in a file, a website or an document. In a database, a metadata is used to give information on the formatting, size and other various information. Over the period of time, various posts are created, updated, deleted; the metadata table becomes large and can degrade your website performance. This tutorial will guide on how you can clean metadata in a WordPress database.

Prerequisites

  • A domain name
  • cPanel Credential
  • WordPress database

Step 1:

Login to your Cpanel and locate phpMyAdmin under Database.

How To Clean Meta Data In A WordPress Database

Click on phpMyAdmin to access the dashboard of phpMyAdmin. Click your database name on the left side menu of your phpMyAdmin control panel.


Step 2:

In this example, you will see prefix with the database name. Here the prefix name is mrr_. Your database prefix name will be different from this example.

How To Clean Meta Data In A WordPress Database

Click on the SQL Tab to access the SQL Query window. First we will learn how to remove the mrr_postmeta. Copy the below set of query to the SQL Query window and click Go.

SELECT * FROM mrr_postmets pm LEFTJOIN mrr_posts wp ON wp.ID = pm.post_id WHERE wp.ID ISNULL;
DELETE pm FROM mrr_postmeta pm LEFTJOIN mrr_posts wp ON wp.ID = pm.post_id WHERE wp.ID ISNULL;

How To Clean Meta Data In A WordPress Database

After executing the query, PHPMyAdmin will give information on how many items were removed, or the results were empty. In this way, you can successfully clean your mrr_postsmeta.

Step 3:

You can also clear the comment meta from your database by executing the following SQL Query in the SQL window.

SELECT * FROM mrr_commentmeta WHERE comment_id NOTIN ( SELECT comment_id FROM mrr_comments );
              DELETEFROM mrr_commentmeta WHERE comment_id NOTIN ( SELECT comment_id FROM mrr_comments );
              SELECT * FROM mrr_commentmeta WHERE meta_key LIKE'%akismet%';
              DELETEFROM mrr_commentmeta WHERE meta_key LIKE'%akismet%';

Here, mrr_commentmeta  is the table name with mrr_ being the prefix name.

Conclusion:

By following the above mentioned steps, you can successfully clean your metadata from your WordPress Database.

Check out the top 3 WordPress hosting services:

A2 Hosting
$1.95 /mo
Starting price
Visit A2 Hosting
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.8
  • Pricing
    4.0
IONOS
$1.00 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0

How To Examine And Repair A Database in PhpMyAdmin

Over the period of time, database can be corrupted and needs to repaired. This t
1 min read
Elizabeth Grom
Elizabeth Grom
Hosting Expert

How to Find Out the Database Details of Your WordPress Website Using cPanel

This how-to guide explains different ways to find out the database name and pass
3 min read
Bruno Mirchevski
Bruno Mirchevski
Hosting Expert

How To Change the Database Port for WordPress

This guide will help you on how to change the database port of your Wordpress we
1 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How To Change The WordPress Database Prefix To Improve Security

This guide will teach you steps of changing the WordPress Database Prefix to imp
2 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top