WordPress sites have an intention to grow their size fast, and the needs for backups and hosting may get out of hand. I often complete a site no more than 500Mb, and after 2 or 3 years my hosting plan has reached its limit. You may think “it’s a platform problem” but usually we haven’t considered all aspects.
Luckily, there are things to do and reduce your WordPress size significantly. You just need to follow these above steps and maybe change some of your habits when adding content.
Why did my WordPress size increase?
It is important to understand how we ended here. What happened to our lovely site and grew that much. Generally, two major reasons can impact the size of your WordPress. The content that has been added and the scheduled backups.
Even if a site that didn’t have any additions for one or two years, may have an increase like that if the backup settings haven’t configured properly. This is the first thing that can double our size in a snap.
My WordPress backups are huge. What to look for?
We need the backups as they are coming on a rescue if anything goes wrong with our site. You may have a manual backup that can be run before attempting any major platform or theme update. Also you can configure your website to run backups in a scheduled mode by using a plugin.
No matter what plugin you are already using, you have to check its settings if the backups are scheduled properly and how many does the plugin stored inside your platform. You should delete the old backups and keep one or two of the latest. Also configure the scheduled backups. The settings that I usually prefer are:
- one full backup every week and retain for 2 weeks period
- one database backup every night and retain for 7 days
One major step of reducing your WordPress size is to store your backups somewhere else like Dropbox, Google Drive, Amazon, etc. Not all plugins give you that ability so I recommend using UpdraftPlus plugin, one of my favorites, that lets you run manual and scheduled backups and connect with over 15 different remote storages.
If you’re reading this post I suppose you are searching for immediate action, so for now, create a new full backup and delete all the others. Let’s keep things as clean and tidy as we can.
Clean up your Media library and free up space
A nice routine after completing a page or a post would be to check if you have uploaded more images than the ones you used and delete those. If it hasn’t been a habit for you, then you should do a thorough check now.
There are many plugins in WordPress that do the job, one of those is Media Cleaner and it’s highly recommended. It analyzes your library and deletes every broken entry or image that is not being used. There is backup trash where it holds the erased media so you can run a check if everything is working before emptying it.
After doing that, our next hypothesis is that you may have an image that is not compressed or saved for the web. WordPress has the function to scale an uploaded image and serve the minimum size to users according to his screen. But even so, your images have to been already optimized.
Find the media that take up more space
There are more disadvantages when using large media files. The user experience is another one. If your page size is big, users will need to wait longer and may leave your site sooner than expected.
You can use GTmetrix to check how your site ranks on a percentage scale. One of the recommendations that is going to give you is which images should be optimized and exactly how much. It also does the job for you, by giving you the optimized file. This can help if you have 2-5 images that need to be optimized. But if you have more you will need another approach.
How to optimize media files, the fastest
Let’s use a plugin that can optimize every media file at once. After trying a lot of plugins I found that Smush by WPMU, even its freemium version, gives you a lot of tools to optimize your site.
After you install and activate the plugin, there will be a wizard guiding you through some steps for the service ahead. In the end, you’ll only have to press the bulk process button to start.
You need to keep the page open for the process to complete and also keep in mind that every 50 images you will have to press the Resume button again.
After all your attachments got “smushed”, you will serve less page-load to your users and your gtmetrix score will be increased at the same time!
Reduce the number of plugins being used
Your WordPress website gets enhanced by using plugins. The problem is that not all plugins have clean code and usually even after deletion, some settings still exist in your database.
Step 1: First you should do a check of unused plugins. Deactivate and delete the ones you decide that don’t give any value and slow down your website. Some plugins may have an option to delete all data after deleting. Check this option if available.
Step 2: Next you may access your file manager through FTP and open wp-content>plugins folder and search for plugins that didn’t respect your decision. If you aren’t sure what every folder has, keep in mind that there is one folder per plugin. You can check your plugins list inside the backend of your WordPress to see what is what.
Step 3: Now you will have to deal with your database. This is a tricky one. You need access to PHPMyAdmin to do so.
The first thing to do after logging in is to export a backup. This will keep you safe from deleting tables that were needed from your website to run as expected. If anything goes wrong, delete all tables and import the backup you downloaded. But fingers crossed, it won’t.
Then, search for table names that shouldn’t be there. One of my recent cleanups had tables leftover from Slider revolution plugin and Wordefence. Delete the tables, if any, and run a database optimize after this.
This is the easy way though. Many plugins don’t create a separate table in your database but keep their info in the options table. This is more difficult for you to find. You should know the exact store slug to find it, but because they usually take less space in our database we leave them intact in fear of breaking the site.
How to use WordPress revisions in your defense
The WordPress revisions store a record every time you save your post to help you save earlier versions. There is a complete system that can show you every revision stored by date and highlights the changes that were made since then.
This is a very useful tool as it also can autosave every 60 seconds your last post state to prevent the risk of losing data.
You can check the revisions stored by post when editing if you have Revisions checkbox checked in Screen options at the top of your backend.
We will use a plugin named “Optimize Database after deleting revisions” to delete all the revisions kept in our database. After installing and activating go to Settings > Optimize database, check the maximum number of most recent revisions to zero and everything else that you think you want to delete. Save settings and go to the optimizer to run the Optimize process.
Now that you have your database optimized once again, you can delete this plugin as well.
Next steps from here. What to do now
At this time, you will have a clean WordPress website with minimum trash in your database and the plugins that you really need. Run a thorough check that everything is working properly in your frontend and backup your site again. Delete the previous backup after this.
Lessons learned, you may change your habits from now on and use the above information for your benefit.
From now on, upload only optimized versions of your images. You can use the “Save for Web” option in Photoshop or the JPEG-mini application on your computer. This way you won’t have major increases in your files.
Keep tidy backups and only the ones that matter.
A well-timed schedule is necessary and using external remote storage will keep your space at the minimum size.
You may also use an alternative for backing up outside your website. Your hosting plan usually includes daily backups that can restore your website or even emails to a previous date. That means that you can delete your older backups with more confidence.
If you’re managing your hosting plan through Plesk, Cpanel or any other platform you can schedule full and incremental backups as well but always keep a Backup plugin activated on your website for every time you need to make amendments on the fly.
Using plugins wiser
There is a rule that says you need no more than 20 plugins to run your website. So every time you install and check a plugin keep in mind that your website may slow down.
You don’t need a plugin to have google analytics or Mailchimp so why using your slot from your 20 plugins tank for this service? Delete unnecessary plugins and update the ones you use once a month for security reasons.
Thinking of Revisions
Keep the number of revisions that you need and make you feel safer. To do so you can use the plugin we used above but following limiting our plugins, I would suggest modifying your wp-config file.
Open your FTP or file manager. Find wp-config.php and open it in your editor. Add the following line:
define( ‘WP_POST_REVISIONS’ , 3 );
where 3 is the number that you want to keep. I use 1 in my configurations. You may change it as you prefer.
Delete unwanted themes
WordPress installation has the latest theme on default. At the time I’m writing is the Twenty-Twenty theme. Usually, those themes are the most compliant with the latest WordPress version and the fastest.
If you are using another theme, it is a good practice to keep the latest default WordPress theme among yours for every time you need to make some maintenance. You can delete all the other themes.