A website is a little like a house: it needs a bit of freshening up and maintenance once in a while to eliminate the clutter that accumulates from day-to-day use. Having a clean and organized website is crucial for ensuring the security, functionality, and performance of your business.
Over time, WordPress installations accumulate dead weight in the form of unused and obsolete code, plugins, bugs, and other unnecessary files – all of which can slow down your website and make it vulnerable to security threats.
It is, therefore, essential to periodically clean up your site’s codebase and remove any unwanted elements to keep your website running smoothly.
In this article, we will provide a comprehensive checklist to clean up and maintain your WordPress site to make sure it is secure and stable and provides a positive user experience.
Cleaning up Your WordPress Site
There are many ways to clean up and optimize your WordPress site to make it more productive, efficient, and performant. We recommend working through every item on this list on a regular basis.
Keep PHP and WordPress Versions up to Date
You should already have a recent backup of your website. If you don’t, then the very first thing you should do when beginning the process of cleaning your WordPress site is to take a complete backup of all the data and store it somewhere off the server.
Once you have ensured you have a full backup of your site, you can start to look at the versions of PHP and WordPress you’re currently running. In our experience, most performance issues originate from plugins or themes that do not support the latest version of PHP or WordPress.
A quick and easy way to improve performance is to ensure that your server is running on the latest version of PHP. Using a PHP version after its end of life is never a good idea. Updating to the latest version can provide a significant performance boost, as well as significantly improve security.
While upgrading to the latest version of PHP can be beneficial, it’s important to test your site’s compatibility with the new version before upgrading. Some plugins and themes may not support the latest version of PHP, which can cause compatibility issues and potentially break your site.
Once you have updated your PHP version, you should run tests to ensure that your site is functioning correctly. To begin with, you should check the appearance and layout of your site to make sure your theme works with the new version. You should also test the login and registration workflows, submit some forms and verify the data. If you are using plugins, verify that they all work with the updated PHP.
You can use the built-in feature in WordPress to check site health and detect issues. Go to “Tools” and open the “Site Health” tab. On this screen, you can find information about your WordPress configuration and any items that may need your attention. If you encounter any issues, you should troubleshoot them before moving on to the next step.
Once you are sure that everything is working as expected, the next step is to upgrade your WordPress version and all the required plugins – as well as themes that you are currently using.
It’s also a good idea to review the fonts used on your website and remove any that are no longer needed. This can help to reduce the amount of data that needs to be loaded, resulting in faster load times.
Uninstall Unused Plugins and Themes
The internet landscape continues to evolve at a fast pace, and if your site has been online for more than a few years, then you will have almost certainly accumulated a number of plugins and themes that are no longer needed.
For instance, many plugins that were previously used for bundling files and optimizing website performance are no longer relevant due to the adoption of HTTP2.
Some plugins intended for the aggregation of scripts, lazy loading, and caching may even have the opposite effect of slowing down your site.
Some plugins may store a lot of data in your cache and logs, which can affect your disk space and server speed. To avoid this, you should regularly delete unnecessary or outdated cache and log files from your plugins. If you are using a caching plugin, it probably already has a cache purge option. Use this from time to time to minimize the performance drag on your server.
If you are using a security plugin, you should seriously reconsider this – you might be relying on a false sense of security. We have an established view of why security plugins are not the smart choice. That article explains what the issues are with using security plugins and why it is far safer to work with a WordPress hosting provider that is able to integrate security at the server level instead.
At Servebolt, in addition to providing this approach, we offer two managed proactive services, Accelerated Domains and Servebolt CDN, both of which can harden your website’s security. They are built on top of Cloudflare’s Enterprise offering and will greatly enhance your site’s security, along with improving its performance.
Having a vast choice of available themes to switch between may seem useful, but when approaching your disk usage quota, you can cut some of the fat and keep only the current and essential theme for your website. This can also include the child themes you no longer use.
It is highly recommended to fully uninstall any plugins or themes that are not being used rather than simply deactivating them. Deactivated plugins still occupy space on the hard disk and might clash with other plugins installed on your server. Some poorly designed plugins can be exploited even when they are disabled. Since disabled plugins are seldom updated, this makes them a serious security risk.
Uninstalling a plugin not only frees up space but also triggers the plugin’s uninstall hooks, effectively removing its settings and other unnecessary data from the database.
Configure the wp-config.php File
WordPress plugins often add code snippets to the wp-config.php file to configure any settings. If you are not using a particular plugin anymore, it is recommended to remove all of its settings from the wp-config.php file completely.
The wp-config.php file is an essential component of any WordPress installation. Apart from storing the database information such as the database name, username, password, and host, this file also allows admins to specify custom settings for their WordPress site.
For example, users can set up secret keys, configure automatic updates, and define the default language of their site. Additionally, the wp-config.php file can also be used to debug WordPress sites by enabling debug mode and displaying error messages.
This configuration file is stored within the root folder of your website. You can access the wp-config.php file via an FTP client like FileZilla, ssh, or your web host’s File Manager.
It is important to note that users should only modify this file if they have a good understanding of the WordPress codebase and the potential impact of their changes. Improperly configured wp-config.php files can cause errors and even render a site inaccessible.
We recommend that you make a backup copy of the default wp-config.php file and add only the necessary salts and database information. Any additional modifications can be done after this. Once you have removed the unnecessary settings, you can add the following settings to optimize your site further:
- Define the WP_POST_REVISIONS constant: This setting tells WordPress how many versions of your posts to keep – you can roll back to one of these versions if something goes wrong. For instance, if you want to retain only three revisions of each post, you can add the following line to your wp-config.php file:
define( 'WP_POST_REVISIONS', 3 );
- Turn off WordPress cron jobs: WordPress cron runs a set of predefined tasks, such as checking for updates, whenever a visitor opens your site. This is unreliable on low-traffic sites and has a serious performance improvement for high-traffic sites.
Instead of relying on WordPress cron, it is advisable to set up system cron jobs to manage scheduled tasks. You can disable WP_CRON by adding the following line to your wp-config.php file:
define( 'DISABLE_WP_CRON', true );
- Turn off debugging mode: WordPress has a built-in debugging mode that can be used to troubleshoot errors. It is essential to turn it off after debugging so that errors are not displayed to the end users. This can be achieved by adding the following line to your wp-config.php file:
define( 'WP_DEBUG', false );
Modify the .htaccess File
The .htaccess file in WordPress is often modified by various plugins. It’s best to keep the configuration as minimal as possible so that it’s easier to manage. Having a smaller configuration file also reduces the chances of misconfiguration.
Most managed hosting services already have optimized server settings for static file caching and compression. Adding additional configuration settings to the .htaccess file may actually slow down your site.
We recommend you use the default WordPress .htaccess file for both single-site and multisite installations. If you do need to add redirects and find yourself frequently editing the file manually, then you should consider using plugins such as 404 to 301, Redirection, 301 Redirects, 404 Solution to store the redirects in the database. Doing this offers better control and reduces the risk of making errors in the .htaccess file that could bring your entire site down.
Clean & Optimize Your Database
Databases are an essential part of your website. Over time your database will accumulate data that is no longer needed or wanted – this is pretty much unavoidable. As a result of this, your website will start to slow down, page load times will grow, exporting and importing procedures will get harder, and on top of that, creating backups is likely to take significantly longer.
The most common reasons for a growing database are:
- Spambots
- Cache
- Logs and analytics data
- Sessions
- Images
- Excessive number of tables
- Large post metadata
Even if you don’t have issues right now, it’s worth considering implementing suitable optimization methods. These will certainly improve the performance of your site and speed up the backup workflow, in addition to making maintenance easier to manage.
Keeping databases in good shape can reduce load times and lead to better SEO rankings and overall improved user experience. Your database is hosted on your server, and you can access it by login in via SSH and running mysql -u <username> -p in the terminal. You can also use tools such as MySQL Workbench to access your database on Servebolt. Once you log in, you can safely remove the tables which are no longer being used to speed up your database queries.
You can also use phpMyAdmin on Servebolt to optimize tables. Start by logging in to phpMyAdmin. In the table overview, recalculate the table statistics; these stats are used to optimize performance when reading and writing data. You can also use it to optimize database performance and speed up database queries with indexes.
Consider deleting unused data such as old post revisions, unused tags or categories, etc. You can either do this manually or use a plugin such as WP-Sweep, which automatically detects bloat and removes obsolete content. Deleting post revisions should not be considered a performance optimization. Any WordPress hosting provider that suggests otherwise simply doesn’t know how to run fast databases. That said, if you aren’t using the data that’s stored, there’s also not much reason to keep storing it. The same logic applies to media files that you upload over time, sometimes for temporary landing pages – it’s good practice to remember to delete the images associated with those when deleting the pages (including in scenarios where you delete an old piece of content).
Delete Old Backups, Temporary Files, and Other Bloat
Are you doing extra backups in addition to our free daily ones – great! The habit of creating backups before you apply any changes can save you valuable time and nerves in the long term. However, you should remove old backups after they become obsolete or download them to your local environment and then delete them from your hosting account to free up space.
You should only ever keep one backup of your site on your server. Your primary backup should always be stored outside your server, preferably in more than one place. If you have more than one copy of a backup on your server, then you should delete it to free up space.
You might also have old SQL backups, zip files, or other large download files on your server. If you ever need to work on a file temporarily, you should use the /tmp directory in Linux – it automatically deletes files and directories to free up space.
You can do this by logging in to your server via SSH and searching for SQL and TAR archives, then deleting each of these on a case-by-case basis. For example, to list all SQL files, run the following command in the terminal:
find . -name “*.sql” -print
You should also search for oversized files in the uploads folder, typically greater than 10MB, and consider compressing or resizing them. You can run the following command to find all files larger than 10 MB:
find ~/ -size +10M
Clearing expired transients, and other temporary data is also a good way to optimize the database and free up disk space. Use plugins such as Transient Cleaner and Delete Expired Transients to keep track of temporary files. You can remove tables associated with deleted plugins, as well as wp_postmeta entries that were orphaned from parent articles when they were deleted.
You should also examine the user accounts on your website. If you have redundant accounts or find an account that hasn’t been used in a long time, then it’s a good idea to remove it. Start by looking for accounts of employees who no longer work for the organization, and then work your way to users who post spam on your site.
Remove Legacy Code
At Servebolt, we regularly run customer disk space utilization through statistical analysis, along with the data we get from the performance reviews and troubleshooting we perform, and the results of these studies show that one of the most significant causes of slow website performance is due to inefficient code.
It’s crucial to review external scripts fetched by your site and examine them carefully. Every external script added to your site can slow down performance, so it’s important only to use those that are absolutely necessary.
The most common log file that you should check on a regular basis is the ErrorLog, which may be found in the ~/logs/ErrorLog. This file is essential as it logs errors that occur on your website for you to investigate and fix.
When cleaning your site, you should scan through the Error Log and MySQL slow logs to identify any issues and address them on a case-by-case basis. In many cases, these problems can simply be resolved by ensuring that plugins and themes are updated to their latest versions.
However, sometimes the error produced can be unimportant, but it could be logged thousands of times per day, increasing the size of the error_log file to several gigabytes.
Read our knowledge base article to know how to find ErrorLog, AccessLog, and Slow Query Log on Servebolt. You might also find it useful to read our article on Viewing and examining log files. You can also use the Servebolt Optimizer plugin – it has a built-in feature that lists out all potential error messages for your site.
Update Your Site’s SEO Efforts
It’s important to keep in mind that SEO is an ongoing process that requires regular maintenance. Once you have completed the task of cleaning up obsolete posts and pages, it’s also a good idea to review your tags and categories.
Consider removing any tags or categories that have fewer than three posts associated with them, as these pages are not favored by search engines and can increase the workload on your server.
After that, you should move on to fixing any broken links on your website. Not only do they harm your SEO ranking, but they also degrade the user experience. You can use tools such as Dead Link Checker, Broken Link Checker by Ahrefs, and Dr. Link Check to find URLs that result in errors. This process may take some time, especially if you have a large website with a lot of content.
By regularly reviewing and optimizing your site’s content and structure, you can improve its overall performance and increase its visibility in search engine rankings. Remember, SEO is not a set-and-forget process but a continuous effort to ensure that your site remains relevant and useful to your audience.
Additional Tips and Best Practices
Once you’ve finished cleaning up your website, it’s important to establish a system to maintain its organization and tidiness in the future. Here are some tips to help you get started:
- Keep your content organized: Use categories, tags, and menus to organize your content systematically. Be sure to use descriptive folder names to make managing and navigating through your site easier.
- Optimize your media files, especially if your site uses a lot of images and videos. Consider using modern image formats such as WebP or HEIC/HEIF, and newer video codecs like AVIF. These formats can significantly reduce the size of media files, saving disk space and bandwidth and making your website faster. You can optimize your media files without the hassle by using Servebolt CDN, a free offering from Servebolt.
- Keep an eye on the number of post revisions. This can be done using the WordPress revision control feature. This feature saves a copy of each draft or revision made to a post, allowing you to easily compare and revert changes if necessary.
- You should delete unused tags and irrelevant content using the built-in WordPress tools, such as the tag and category management pages. These pages allow you to quickly delete any unused or irrelevant tags or categories.
- You should also take a closer look at unapproved auto drafts. Check for any unapproved drafts and either publish or delete them as needed to ensure that your site remains fresh and relevant.
- Optimize your metadata and internal linking to improve your site’s search engine optimization. Make sure you optimize your metadata (titles, descriptions, etc.) and internal linking structure to improve your site’s SEO.
For metadata, you should use your target keyword in each element and follow the recommended length limits for each element: 60 characters for the title tag, 155 characters for the meta description, 3-5 words for URL, and 70 characters for the heading tags. For internal linking, use descriptive anchor text that matches the topic of the destination page.
You can use various plugins and software to help you optimize your metadata and internal linking. For example, you can use Yoast SEO or Rank Math to edit your metadata and get suggestions for improvement. You can also use the Google Search Console to monitor your site’s SEO performance and identify areas for improvement.
- Cache your data and use a CDN: Modern caching algorithms and Content Delivery Networks (CDNs) can dramatically improve your website’s loading times, especially for visitors located far from your server. If you aren’t already using a CDN, you should definitely switch to using this kind of solution.
Servebolt’s Accelerated Domains is an all-in-one security firewall, CDN, and image optimization tool. It can provide a significant boost to your website’s performance by taking advantage of edge computing and advanced caching techniques. Talk to an expert to find out more!
After Action Report
Taking the time to perform regular maintenance on your website may seem a relatively unimportant task, but it is well worth the effort. By removing unused and obsolete code, plugins, and other elements that are no longer needed, you can improve your website’s speed, reliability, and overall user experience.
By following the tips and best practices discussed in this article, you can ensure that your WordPress site stays in top shape and delivers an exceptional experience to your users.
At Servebolt, we understand the importance of a clean and optimized website, and our hosting services are designed to help you achieve just that. With our lightning-fast servers, advanced content delivery networks, and top-notch security features, we provide everything you need to keep your website running smoothly. So why wait? Switch to Servebolt for the best WordPress hosting experience possible.