WordPress database general cleanup

After installing the pro version or the free version of the Advanced Database Cleaner plugin, you can proceed to clean up several types of orphaned items that may exist on your database. This tutorial concerns the "General clean-up" tab of the plugin in which you can clean items such as revisions, auto-drafts, orphaned post meta, expired transients, etc.

First, don’t forget to make a backup of your database before starting any cleanup. This is very important! In case something went wrong, you can restore it.

In this article

Overview of the "General clean-up" tab

Select the 'General Clean-up' tab:

Advanced Database Cleaner tab

The following screenshot gives an overview of all elements on the page:

WordPress database general clean up

1
This is the list of all data you can clean up in the "General clean-up" tab of the plugin.
2
The "count" column gives the total of elements found for each type of data to clean up.
3
Click on the "Eye" next to each item and you will get a list of elements that will be deleted in each category. You can then choose to either clean up the whole category or only some specific elements.
4
This column indicates if the item has been scheduled to be cleaned automatically. If so, a green icon will appear with the name of the scheduled task.
5
"Keep last" specifies the data you want to keep in each category. In other words, this means, keep the last x days’ data from being displayed, and therefore from being cleaned. The plugin will always show only data older than the number of days you have specified. For example, If you want to keep revisions of the last 7 days, then click on "Edit", choose 7 in the text field then save. The plugin will then show only revisions older than 7 days so you can clean them.
6
When you select some items to clean up, this dropdown menu lets you choose which action to perform. You will find different actions depending on each tab of the plugin. Only one action "Clean" is available for the "General clean-up" tab.
7
After selecting items to clean up and the action to perform, click on "Apply" to delete selected items (a confirmation box will appear to confirm the clean up).
8
This indicates if there are any items to clean up. It gives the total of all numbers in the "Count" column.
9
In this box, you can view the scheduled cleanup tasks you have created. You can also add a new scheduled task to automatically clean up the specified data. More details can be found below.

Details about items you can clean up

If you need more information about each item in the "General clean-up" tab, you can either click on the info icon on the left of each item or click directly on one of the following links to go to the corresponding articles for more details:

  1. Revisions
  2. Auto drafts
  3. Trashed posts
  4. Pending comments
  5. Spam comments
  6. Trashed comments
  7. Pingbacks
  8. Trackbacks
  9. Orphaned post meta
  10. Orphaned comment meta
  11. Orphaned user meta
  12. Orphaned term meta
  13. Orphaned relationships
  14. Expired transients

Clean up orphaned items

Select items you want to clean up, then select 'Clean' in the dropdown menu and click on the 'Apply' button. This should clean up all the selected items. 

Clean up WordPress database

To be sure that items you selected have been deleted, you will notice that the "Count" column next to each item you deleted is now "0".

If you don't know what to clean and what to keep, clean up the following items since they are safe to delete:

Clean up WordPress database by deleting revisions and orphaned post meta and expired transients

If you need to see exactly what will be deleted, click on the "Eye" icon on the right of each item you want to clean up, a detailed list of elements will be displayed so you can have a clear idea about what you are deleting. For example, if we click on the "Eye" for "Pending comments", you will get something like:

Clean up WordPress pending comments

You can then select specific items to delete, select "Clean" on the dropdown menu and click on "Apply".

You can also filter items by searching for specific words. To do this, type what you are searching for in the "Search for" text field, select where you want to search (either in the name of the value of the current category item), then click on the "Filter" button.

Schedule a cleanup

To schedule an automatic cleanup that runs at regular intervals, click on the "General clean-up" tab of the plugin, then click on "Add new schedule":

schedule WordPress cleanup task

You will get the following page on which you can specify your schedule parameters:

Schedule WordPress cleanup task

1
Check the boxes next to the elements you want to include in the scheduled cleanup task.
2
"Keep last" specifies the data you want to keep in each category based on days. For example, 0 days means "clean up all data in the category", 7 days means "Clean up all data older than 7 days but keep data of the last 7 days". This parameter cannot be changed from this page. To change it, go back to the "General clean-up" tab.
3
Enter a name of your choice for your scheduled task. The name may contain only: letters, numbers, and underscores.
4
Set the frequency of your scheduled cleanup task, it can be either: Once, Hourly, Twice a day, Daily, Weekly, or Monthly.
5
Enter a start date for your task from which the clean up will start.
6
Enter a start time for your task from which the clean up will start.
7
Set the schedule to either "Active" to enable it, or "Inactive" if you want to save it but not run it.
8
Click on the "Save the schedule" button.

Your cleanup scheduled task is now saved and will run based on your parameters! You can add as many scheduled tasks as you need. You will notice a new box on the "General clean-up" tab with information about all your scheduled tasks:

Schedule WordPress cleanup task

1
This box shows your scheduled task information.
2
Each element that is included in one of your scheduled tasks will have a green clock. Elements with a grey clock are not included in any scheduled task.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.