How to Clean Up All the Unused Data in WordPress

gretathemes

GretaThemes

Posted on December 8, 2020

How to Clean Up All the Unused Data in WordPress

Cleaning up unused data periodically and regularly unloads your WordPress website, thereby reducing the loading time. Therefore, this is a useful technique that all webmasters should know.

There are two ways to clean up unused data: manual or plugin-using removal. I recommend that you should use both of them as I’m doing in this article.

Note:

Removing data may affect the operation of your website. Therefore, make sure that you have a backup of your WordPress site before doing the next steps.

Manually Clean Up Unused Data In WordPress

Theme

You should delete unused themes to make it easier to manage and save space. To do that, go to Appearance > Theme, then select the theme you want to delete, hit Theme detail > Delete > OK.

Remove a theme in WordPress to Manually Clean Up Unused Data In WordPress

In addition, If you want to improve the performance of your WordPress theme, refer to this article.

Plugins

Some plugins can auto-generate data, thereby slowing down the website loading speed. So if you don't need to use a plugin anymore, let’s delete it. You can delete a plugin directly from the Admin Dashboard, but this doesn’t completely remove all the plugin’s related data. So, you can refer to this article to learn about how to completely remove a plugin's data on the WordPress website.

Post

Delete the Inappropriate Posts

You should periodically review the contents on your website and delete the duplicated, outdated ones, and the articles that have incorrect information as well.

For example, if your website has the article "Top 10 best food stores in Hanoi" but after a while they closed or relocated, you should edit or delete this article.

Delete Drafts of Revision

The Revision feature of WordPress helps to generate drafts to save changes in posts and restore them in case there are any problems (power failure, Internet disconnection, etc.). These drafts take up space on the website. Therefore, if you don’t need these drafts anymore, let’s delete them. The easiest way to do that is using a plugin as in part 2 of this article.

Anyway, you should reduce the amount of auto-generated drafts by limiting the number of them for a post and the time to auto-save one. To do that, add the following code to the wp-config.php file:

  • Code to limit the maximum number of drafts:
define (‘WP_POST_REVISIONS’, 10);
  • Code to limit the time for auto-saving drafts:
define (‘AUTOSAVE_INTERVAL’, 600);

Explanations:

  • 10 is the maximum number of records to be saved.
  • 300 is the time to automatically save the record, the unit is seconds (s)

Page

You should remove unnecessary or unsuitable pages to unload your website. Go to Pages in Admin Dashboard, choose All Pages, select the page that you want to delete then press Trash.

remove unnecessary or unused pages to unload the WordPress website.

If you are still confused between Post and Page, please refer to this article!

Categories and Tags

You can delete tags and categories directly from the Admin Dashboard by going to Post > Tags / Categories, then select the tags or categories that you want to delete and press Delete.

delete unused data in tags and categories directly from the Admin Dashboard

Media Library

When you upload photos and videos to the Media Library, WordPress may create several copies of multiple sizes for display in different places. These data will slow down your website, so you should delete them.

Generally, to delete these media, we go to Media > Library, select images / videos and hit Delete. However, this way will take a lot of time when the number of photos and videos is too much. You can refer to some plugins for removing media faster such as WP-Optimize or Media Cleaner.

Tips: Instead of uploading media directly to your website, you should upload them on another storage platform like Youtube, Imgur, ... and embed their links in the article. Thus, your website will not have to store this data anymore.

Clean Up Unused Data in WordPress Using a Plugin

On the market, there are many data cleansing plugins that we have had a detailed review here. You can choose one of them.

In this article, I use WP-Sweep - a fast, stable, powerful, and free plugin. It is one of the best plugins for cleaning up unused data. To use this plugin, let’s do as follows:

First, WP-Sweep has a free version on wordpress.org so you can install and activate the plugin directly from the Admin Dashboard.

Clean Up Unused Data in WordPress Using a Plugin

To use the plugin, go to Tools > Sweep. In the plugin interface, you have many options for cleaning and optimizing your data like the following:

Post Sweep

In this section, you’re able to clean up post-related data like:

  • Auto drafts that are created by Revision
  • Unused data of posts that were deleted
  • Duplicated Post Meta (Data that is generated when you clone a post)
  • oEmbed Caches In Post Meta (The cache is to store data about links that is embedded in posts)

If you want to delete any type of data, just hit the Sweep button. Besides, you can hit Details to see the data that you will remove. Do the same with other sections.

clean up post-related datain WordPress

Comment Sweep

This section allows you to clean these data types below:

  • Unapproved Comments
  • Spammed Comments
  • Deleted Comments
  • Orphaned Comment Meta (It’s the data remaining after you remove a comment)
  • Duplicated Comment Meta (Data that is generated when cloning the comment)

Clean up Comment Sweep in WordPress

User Sweep

In this section, you’re able to clean up user data like the following:

  • Orphaned User Meta
  • Duplicated User Meta

In the below picture, my website doesn’t have any user data that needs to be cleansed so that the Sweep button changes to N/A. Otherwise, the Sweep button will appear.

Clean up User Sweep data in WordPress

Term Sweep

This section allows you to clean up these unused data below:

  • Orphaned Term Meta (Term meta is data created for each term of taxonomy, it usually provides additional information and is not stored in WordPress terms table. When deleting a term from taxonomy, its term meta becomes “orphaned”)
  • Duplicated Term Meta
  • Orphaned Term Relationship (whenever you add a post in a category, it will create a term relationship file. This file will be retained and called orphaned when you remove that post)
  • Unused Terms

Note that pressing Sweep in this section will delete the leftover data of the term in the post’s drafts, so please check carefully in the Detail section before deleting.

clean up the unused data in Term Sweep

Option Sweep / Database Sweep

In these two sections, you can clean up unused data in Transient memory and optimize the database table of the website. The plugin doesn’t mention how to do it in a detailed way so that you just need to choose to hit Sweep or not.

clean up unused data in Transient memory and optimize the database table of the website.

In case you want to delete all the above types of unused data, take a quick review of all of them then press Sweep All. That’s done!

Last Words

Cleaning up unused data is an effective way to speed up your website. Therefore, I recommend that you should scan and clean up unused data on your site periodically and regularly. In addition, you can also refer to other ways to speed up your website in this series. Good luck, and do not forget to follow our upcoming posts to gain useful techniques about WordPress!


The publication at GretaThemes.

💖 💪 🙅 🚩
gretathemes
GretaThemes

Posted on December 8, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related