How to Clean WordPress Database

How to Clean WordPress Database: Tips and Tricks

Last update on:

How many times have you been frustrated with a WordPress database that just won’t clean up? Well, this post is all about how to clean a WordPress database using plugins and some manual ways.

Also, in this article, we’ll discuss the importance of cleaning a website’s database regularly as well as provide you with a few tips on how to do it.

We’ll also show you what kind of problems can happen if you don’t clean your site regularly and give advice on how to avoid them altogether.

Why do you need to clean the database?

WordPress is a CMS (Content Management System) that stores all of its data in the database. To avoid having to maintain several copies of your site’s content, WordPress saves everything you publish (every post and every comment) to the same place, which is your website’s database.

While this can be convenient for managing updates to posts or pages over time, so in this case cleaning up old entries is necessary.

A clean WordPress database helps search engines find your blog articles and users when they are browsing your site. Your website is slow because it’s cluttered by outdated information from spam comments or abandoned product reviews. You can read this post to learn more about why your website is slow.

A clean server is also good for search engine crawlers, which look through a webpage’s content to find out what it’s about and whether they should add it to their index.

A cluttered WordPress blog post with lots of spam comments will be hard or impossible for these bots to parse, so removing those entries from the database helps make sure that Google knows something interesting is going on here!

What Database Items should you optimize?

There are a variety of fields/items that you can optimize in your WordPress database. Some of the more important ones include:

  • Comments, Posts, Custom Fields, and/or Taxonomies (e.g., tags). These should be optimized regularly to clean out any spam or abandoned entries.
  • Inactive Users: You can remove inactive users from your blog’s database because they will use up disk space on your hosting server. People who have not logged into their accounts for over thirty days. Here, you can use iThemes security plugin that lets you alert about Inactive users in real-time.
  • Spam Comments: If you have many spam comments on your blog, it may be time to clean those. This is done by deleting the comment and removing its ID from one function in your WordPress database.

To make this process easier, there are plugins that will help with these tasks! There are many plugins available, but I recommend WP-Optimize or WP Rocket for general usage because both are easy and effective. You can use other plugins if desired, depending on what cleaning needs.

Backup Your WordPress Database Before Cleaning

Before cleaning or optimizing a WordPress database, you should back up the database first.

The plugin BackupBuddy is one of the best plugins for backing up a database. This plugin has a built-in scheduler to automatically backup your WordPress Database at scheduled intervals like every day, week, or month. You can read another guide on BackupBuddy vs Duplicator.

Read: How to Restore WordPress Site with BackupBuddy? Easy Guide

You can also use it to export an SQL file and run a batch query on all of the tables if you need to repair them manually.

You should always make sure that there is a backup before doing any cleanups!

How to Clean WordPress Database Manually?

You can clean a WordPress database manually by deleting spam comments, post drafts, and other unnecessary data from the WordPress dashboard.

To clean the WordPress database manually, you can use a plugin called WP Bulk Delete that lets you clean the entire WordPress database or delete anything from WordPress quickly.

So download the plugin, then upload and activate it just like any other plugin. Then, go to the WP Bulk Delete menu, which is located on the left sidebar of the WordPress dashboard.

Then, clean up post revision, trash, and autosave with just a single click.

WP Bulk Delete

Besides, you can set a scheduled cleaning process. To enable scheduled cleaning, you need to set this by individually.

However, click on any option that you want to clean or schedule. This will delete any posts in draft mode or scheduled for future publication, as well as old revisions from previous versions of a post that are no longer needed after you publish an article once. 

Not only are these fields used to clean up the database, but more filters are available, such as comments, users, meta fields, terms, etc.

Some people like to clean up their database by deleting every single table row individually, which takes a lot more time than using a plugin. So, if you really need to delete manually, you can use the above bulk delete plugin.

Here are more things you can consider cleaning a WordPress database:

  • Deletes attachments in the database which are no longer active on your site
  • Eliminates empty terms (tags) and categories that may be cluttering up your database.
  • Delete the old posts & comments
  • Delete all the comments in your database
  • Delete all the terms in your database
  • Clear out any other data that is no longer needed from your WordPress installation, such as plugins or themes you don’t use anymore and old backups of files like images.
  • Empty trash to delete any temporary files
  • Clean up your blog’s sidebar widgets and menus
  • Remove all unused plugins from your site
  • Check for broken links on your site, then fix them if necessary

WordPress database clean-up plugins

There are a few plugins that will automate the process of database cleaning for you. You can clean up your WordPress site using these or use them to keep things running smoothly with regular maintenance:

Most recommended database cleaning and optimizing plugins are

  • WP-Rocket: This plugin is designed to optimize your WordPress site and clean up the database.
  • WP-Optimize: This plugin will clean up the database, optimize images, and compress your site.
  • WP-Sweep: it is a free, simple, manual WordPress database cleaning plugin.

Cleaning up your WordPress Database with the WP-Optimize plugin

Here is the step-by-step guide on how to clean your WordPress Database with the WP-Optimize plugin.

WP-Optimize has both free and premium versions. You can optimize a WordPress database or clean a database using both versions. However, in the free version, you can’t enable the scheduled clean-up process.

In this guide, I’ve used its premium version. So, if you want to use its pro version, you can buy it from here, then upload the plugin file to your WordPress site and activate it.

Notice: WP-optimize is not only for database optimization; it’s a full-fledged WordPress optimization plugin and is actually one of the most popular ones.

Now go to the WP-Optimizer> Database

wp optimize database

Now select which file of the database you want to optimize, then click on the ‘Run all optimizations’.

Now, wait a few minutes until the entire process is finished. You can clean up or optimize databases instantly or one by one. But before cleaning, make sure to back up the database.

wp optimize database optimization

If you use the Updraftplus plugin, you never need to use another plugin to back up databases separately. Updraftplus is compatible with WP-Optimize and will automatically back up the database in the background before any changes are made by the WP-Optimize plugin.

If you want to schedule optimization, go to the WP-Optimize database’s settings option and set it to clean up once a month. Other options are ‘daily’ or ‘weekly’. Finally, click on ‘Save settings‘.

wp optimize scheduled clean up

WP-Optimize is an all-in-one WordPress optimization plugin for improving load time. Decreasing database size is only one of its options to speed up site performance. Optional settings include page caching (cache for 30 seconds) and browser cache expiration (60 minutes).

Some core benefits for cleaning WordPress database using the WP-Optimize plugin:

  • Better site performance and optimized database size.
  • Decreased page loading time due to smaller databases.
  • Easier backups and restores: The backup process can now be done easily If you use Updraft Plus with it.
  • Clean your WordPress with no downtime and without affecting your website’s front end (no manual work required). This is also great if you’re not an experienced developer, as it’ll take care of all tasks automatically.

The plugin includes both automatic and manual options for cleaning a WordPress site’s database, which range from immediate deletion or purging to scheduled cleanup on specific dates.

Cleaning up your WordPress Database with WP Rocket

Here is the step-by-step guide on how to clean up your WordPress Database with the WP Rocket plugin.

Notice: WP Rocket is a premium plugin that is one of the most popular among WordPress users. It’s a good WordPress caching and speed booster and even a database cleaning plugin. You can use it to clean databases and improve website speed.

To get the benefits of WP Rocket, you have to purchase it for just $49 for a single site with one-year updates and customer support. However, you can extend its license limits.

Let’s get back to the guide and see how you can use WP Rocket to optimize your database. After installing and activating WP Rocket, go to the WP Rocket page on your dashboard and navigate to Settings -> Database cleanup tab. (you can also do this by clicking on “Database Cleanup” in the Dashboard menu)

WP-Rocket automatic database Cleanup

Here, you’ll be able to clean up your WordPress database, including removing old revisions of posts or pages, spam comments from different users, etc. You can do this with just one-time cleaning or scheduling it as a daily or weekly task that will run automatically at a certain time.

Some core benefits for cleaning WordPress databases using the WP Rocket:

  • It’ll clean up your WordPress database and speed up the website by not saving time for loading a lot of unnecessary data.
  • This plugin is compatible with all versions of WordPress, so you don’t have to worry about compatibility issues.
  • WP Rocket also helps speed up site load times, which means increased user engagement on your blog or online store.

Optimize/Clean WP Database Using WP Sweep

WP-Sweep database optimization plugin

WP Sweep is a free database optimizer plugin for WordPress websites. It’s a great plugin for fixing many problems that may be slowing down your website’s admin or front end.

It is compatible with ALL themes and ALL versions of WordPress and can be used together with other speed optimization solutions.

It works by identifying unused database tables and dropping them completely so that your overall database size is reduced. It also detects unused fields in tables and drops them, which adds to the performance benefits of using this plugin.

One thing is that, unlike WP Rocket or WP-Optimize plugins, you cannot set automatic database optimization systems. So, WP Sweep is only for manual optimization.

Let’s start to learn how to optimize the WordPress database using the WP Sweep plugin.

First, install and activate WP Sweep like any other plugin. Then, go to the Tool section of the WordPress dashboard and click on the ‘WP Sweep‘ option.

WP Sweep options

Now, you will see the WP Sweep database optimization dashboard. Here, you can see which database option/field you need to optimize. The plugin allows for optimizing the posts, comments, users, terms, and options. You can manually optimize or clean your site database for each section.

Although it has an option button for ‘Sweep All,’ which you can use to clean up everything in one go. That’s all. Using WP Sweep is very simple.

Note: Before taking any action using WP Sweep, you should back up your WordPress database.

Other Plugins That Clean Your Database

  • WP Cleaner Pro: This plugin will delete comment records left in the database from previous versions of WordPress and can also be used to remove spam comments on your site automatically.
  • Database Cleaner: This plugin helps you manage backups, file permissions, database optimization, and more for a smoother-running site.

In Conclusion

In this article, I’ve shown you different ways of cleaning your WordPress database. There are a lot of important things to know before proceeding with a clean-up process, and hopefully, this article has helped you be confident by knowing what will happen and not worrying about losing anything on your site.

Now, you will be able to decide which method suits your needs best, either by using plugins such as WP Rocket (recommended) or manual methods like deleting posts, spam comments, cookies, etc. Go ahead with the right clean-up process according to your needs. Happy blogging!

What’s your Reaction?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Author

  • Palash Talukder

    Palash Talukdar is a digital marketer & the founder of WP Basic Pro. He has been building and managing WordPress websites for 5+ years. He loves to write about WordPress, SEO, marketing, productivity, and web performance.

    View all posts
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Saeed Khosravi's Official Site