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?
- What Database Items should you optimize?
- Backup Your WordPress Database Before Cleaning
- How to Clean WordPress database Manually?
- WordPress database clean-up plugins
- Other Plugins That Clean Your Database
- Frequently Asked Questions (FAQs)
- In Conclusion
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 that 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 the search engines find your blog articles and users when they are browsing your site. Your website is slow because they’re cluttered by outdated information from spam comments or abandoned product reviews. You can read 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 them 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’re 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 a WordPress database or an optimizing database, you should backup the database first.
The plugin BackupBuddy is the best 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.
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 like other plugins activation processes. 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.
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 is no longer needed after you publish an article once.
Not these fields to clean up the database, more filters are available like comment, user, 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.
The 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 database using both versions. But in the free version, you can’t enable the scheduled clean-up process.
However, in this guide, I’ve used its premium version. So if you want to use its pro version, just simply buy now, then upload the plugin file on your WordPress site and activate it.
WP-optimize is not only for database optimization, it’s the most popular and main competitor caching plugin of WP Rocket.
Now go to the WP-Optimizer> 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 one by one. But before cleaning you should backup the database.
If you use the Updraftplus plugin, you never need to use another plugin for backing up databases separately. Because Updraftplus is well compatible with WP-Optimize.
If you want to schedule optimization, go to the setting option of the WP-Optimize database, then set it to clean up once a month. Other options are ‘daily’ or ‘weekly’. Then finally click on the ‘Save settings’.
The WP-Optimize is also an all-in-one WordPress optimization plugin for improving load time, decreasing database size as well as speeding 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:
- For better site performance & optimize database size.
- Decreased page loading time due to smaller databases.
- Easier backups and restores: backup process now can be done in one click! If you use Updraft Plus with it.
- Clean your WordPress with no downtime or affecting the content of the blog post (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.
WP Rocket is a premium plugin, which is most popular among WordPress users. It’s a good WordPress caching and speed booster, even a database cleaning plugin. So you can use this not only for cleaning databases, but also you can use it for improving website speed.
Getting the benefits of WP Rocket, you have to purchase it for just $49 for a single site with one-year updates and customer support. But you can extend its license limits.
However, back to the guide, install and activate WP Rocket on your WordPress like other plugins.
Then go to Settings -> Database cleanup tab. (you can also do this by clicking on “Database Cleanup” in the Dashboard menu)
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 database 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 in speeding up site load times, which means increased user engagement on your blog or online store.
Optimize/Clean WP Database Using WP Sweep
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 just adds to the performance benefits of using this plugin.
One thing is that you cannot set automatic database optimization systems like WP Rocket or WP-Optimize plugin. So WP Sweep is only for manual optimization.
Let’s start to know how to optimize WordPress database using the WP Sweep plugin.
First, like any other plugin install and activate WP Sweep. Then go to the Tool section of the WordPress dashboard and click on the ‘WP Sweep‘ option.
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 optimizing the post, comment, user, term, option, and Database. You can manually optimize or clean your site database for each section.
Although it has an option button for ‘Sweep All‘, so you can use this. That’s all, using WP Sweep is very simple.
Note: Before taking any action using WP Sweep, you should backup 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 will help you manage backups, file permissions, database optimization, and more for a smoother running site.
Frequently Asked Questions (FAQs)
Some frequently asked questions about cleaning a WordPress database:
In this article, I’ve shown you different ways of cleaning your WordPress database. This is an important thing to know before proceeding with the clean-up process, you can be confident in knowing what will happen and not worry 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, post, spam comments, cookies, etc. Go ahead with the right clean-up process accordingly. Happy blogging!