How to De-Clutter Your WordPress Site

There’s been a movement afoot to remove clutter from our lives. Following author Marie Kondo’s question of whether an item “sparks joy”, people are tossing junk left and right. And frankly, we should be doing something similar when it comes to our WordPress websites.

Over time, a site can get gummed up with all sorts of items that are no longer needed. This can degrade performance and result in an unnecessarily large storage footprint. It can also overcomplicate the process of troubleshooting problems.

Of course, there are some differences between cleaning out your attic and your site. With a website, you have to be extra careful in what you remove. Otherwise, you could be left with broken links or worse. Therefore, caution is always recommended.

Today, we’ll point you towards some areas where virtual garbage can begin to pile up. And we’ll also introduce you to a few tools that can help make the cleaning process that much easier.

Cut the Low-Hanging Fruit

On a typical WordPress site, you shouldn’t need to look very far to find unnecessary items. This is particularly true for both the plugins and themes areas.

WordPress itself comes with a default theme. And as new default themes are released, they may become a part of your install as well. While these themes are nice enough, if you’re not actively using one of them, what’s the point of keeping them around?

The same goes for plugins. Beyond the default Akismet and Hello Dolly offerings, users have been known to add all sorts of experimental junk here as well. It seems that we love to install all manner of plugins and either: a) play around with them for a bit, then abandon the effort, or; b) install the plugin and never bother to activate it at all.

This goes well beyond just clutter. It can actually be a security risk. For instance, if an unused theme or plugin has a security flaw, a bot (or a human) may be able to sniff it out and exploit it.

Fortunately, this should be the easiest stuff to remove. The main rule of thumb is: If you’re not using it, get rid of it.

Trim Old Content and Revisions

Just about every site has some measurable amount of outdated or unused content. This could include anything from a 10-year-old blog post about how great the iPhone 3GS is, to those items you marked as drafts that were never quite finished. Not to mention the potentially thousands of revisions WordPress saves as you make changes to your content.

Even small sites can suffer from this level of clutter. As these items start to add up, your site’s database can become a bit bloated. And for a large website, this can result in significantly slower performance. As such, it’s worthwhile to do some cleanup.

Remove Drafts
The quickest and easiest thing to do is to review and remove all of the page and post drafts within your site. WordPress makes this easy, as you can use the menu at the top of the page/post listing to filter out everything but drafts. From there, it’s just a matter of deleting those items that you know you’ll never use.

Limit Revisions
Every time you make a change to content and save it, WordPress keeps track of it (plus an ‘Autosave’ as you make edits) in the form of a revision. This comes in handy when you want to restore something to its previous state. However, you may not want to keep an unlimited number of them lying around.

Through a quick addition to your site’s wp-config.php file, you can limit the amount of revisions WordPress will keep for any single content item:

define( 'WP_POST_REVISIONS', 5 );

Determining a number may be difficult, as you never know how far you’ll need to go back in time. However, it is important to place some sort of limitation here, as it’s a huge source of clutter. For most sites, 5-10 revisions should be enough. In the snippet above, we’ve decided to keep 5 revisions.

Use a Tool
As usual, there are a number of WordPress Plugins available to help make for a smoother process. Depending on your specific needs, WP-Optimize, WP-Sweep and Optimize Database after Deleting Revisions are all popular and highly-recommended choices.

Each one covers similar territory, cleaning up old revisions, comments and other database-bloating junk. Some offer automatic cleanup, adding an extra layer of convenience. Check them out and see which one is the best fit for your situation.

Look for Homeless Media Files

Another potentially messy situation can arise when you have unused media files hanging around. Images are perhaps the worst perpetrators, as uploading a single one outputs several thumbnail versions. Plus, many plugins (such as photo galleries and sliders) churn out their own specific thumbnail sizes. Things can go from merely messy to a full-blown hoard in a short amount of time.

Having multiple versions of an image isn’t necessarily bad – as long as you’re still using them. But there may be a number of images, pdfs and other media files that aren’t being used at all. These “homeless” files take up storage space and can slow down processes such as Media Library searches.

While you can certainly go through your /wp-content/uploads/ folder with a fine-toothed comb, it can be near impossible to weed out each and every unused file. It’s also a process that’s ripe for mistakes. That’s where a plugin such as Media Cleaner can be of great help.

It will scan your uploads and look for files that aren’t associated with a WordPress post, photo gallery, etc. There’s also a separate “Trash” bin that allows you to double-check to make sure a file is safe to delete before taking action.

Keep It Clean

Virtually every WordPress website can benefit from some routine house cleaning. And, unlike that pile waiting for you in the kid’s room, this type of cleanup doesn’t require a whole lot of effort. With the help of some handy tools, much of what needs to be done can be automated.

Still, it’s worth noting that you shouldn’t delete anything from your site without understanding the consequences. That’s why it’s always recommended to keep fresh backups around – just in case.

Once you’re prepared to move forward, you can toss out the bloat and experience the, well, joy that comes from a squeaky-clean website.