The basic look and functionality of a website in WordPress are primarily determined by its theme. It is entirely possible that you will try out a few themes on your website over the course of a few years.
Several new files get added whenever you install a new theme on your website. This includes code-related files as well as images and other such assets. In this tutorial, I will show you how to safely delete a WordPress theme from your website and why deleting themes is important.
Benefits of Deleting a WordPress Theme
The first question in your mind is probably why you should delete a deactivated WordPress theme at all. Whenever you install and activate a theme, all other themes on your website get deactivated. Deactivated themes don't usually do anything on your website. They just have the potential to cause problems. Here are some benefits of deleting a WordPress theme.
Save Storage Space
Deactivated themes still take up space on the server. When you deactivate a theme, the files don't just disappear. They stay on your server. This takes up precious space that you could have used to store other essential files. Getting rid of these files will also save you time while creating backups or scanning your website.
Avoid Potential Security Vulnerabilities
Another problem that can crop up with deactivated themes is potential security threats. A theme doesn't have to be active for any attackers to exploit its vulnerabilities. Someone with malicious intent can still gain unauthorized access to your website through outdated, deactivated themes. They can also do the same through associated plugins and dependencies which have known vulnerabilities.
Deleting a Theme in WordPress
There are multiple ways of deleting a theme in WordPress. I will discuss all of them in this section. You should consider taking a backup of your website or the theme itself if you have made changes to it. Once you have backed up your website, you can proceed with the deletion.
Deleting a Theme Using the Admin Dashboard
The easiest way to delete a theme in WordPress is to do it through the admin dashboard. Once you have logged in to the admin dashboard, navigate to Appearance > Themes. This will show you a list of themes that you have installed. The list contains both active and inactive themes. You will also see some child themes if you have any.
Hover over any of those themes, and you will see the Theme Details button. Click on it to see a new window that lists the details of the selected theme. There should be a Delete button at the bottom right corner that you can click to delete the theme. Once you click on the Delete button, WordPress will ask you one last time if you want to proceed with the deletion. Click OK, and the theme will be deleted.
You cannot delete an active theme. Therefore, if you don't see the Delete button, it is probably because either the theme or its child is currently active.
Deleting a Theme Using the Webhost File Manager
It is also possible for you to delete a theme through your hosting control panel. All you need to do is log in to the control panel, which is cPanel in my case. You will see a huge list of tools once you are in.
Keep scrolling down until you see some file management tools. You will find an option to access the File Manager as shown below. Click on it to see all the files and directories under your web hosting account.
Navigate to public_html/wp-content/themes/ to see a list of all installed themes. Each of those themes will have its own directory. Select the directory of the theme that you want to delete, and hit the Delete button as shown below.
This will delete the theme from your WordPress website.
Deleting a Theme Using an FTP Client
Another way to delete a theme is by using an FTP client. There are a lot of free ones available, such as FileZilla and WinSCP. You can use the one that you like the most.
You will have to navigate to the public_html/wp-content/themes/ directory to see the list of all installed themes. Each theme will have its own directory. Right-click on the directory of the theme that you want to delete, and then select Delete from the context menu as shown below.
The FTP client will ask you to confirm if you really want to delete the directory. Press OK, and you will be good to go. This process can be a bit slow compared to other methods.
Reasons to Keep a Disabled WordPress Theme
Only one theme can stay active on a WordPress website at a time. All other themes will stay disabled, and they usually serve no purpose. However, there are two situations where you might want to keep a disabled or unused WordPress theme.
You Are Using a Child Theme
A child theme is useful when you want to change minor things related to your main website theme. The primary reason for using a child theme is that any changes you make will be preserved across updates to the parent theme.
A child theme depends on its parent for files that are not included in it. Therefore, you should not delete a theme if you have a child theme that depends on that theme.
This situation won't arise if you are deleting the themes through the WordPress admin dashboard. You won't see the Delete button on the parent theme once you click the Theme Details button in this case.
However, you have to be careful not to delete the parent of an active child theme if you are deleting themes using the webhost file manager or an FTP client.
You Want to Keep a Theme as Backup
It also makes sense to have at least one more theme other than your current theme as a backup. The default WordPress themes are ideal for this purpose. They will be relatively harmless compared to other alternatives.
Having a backup theme can minimize downtime when the active theme is experiencing compatibility issues. It allows you to have more flexibility and security when working on your website.
Doing Further Cleanup After Deleting a WordPress Theme
Simply deleting a WordPress theme will not automatically clear up all the related clutter of that theme from your server. Here are a few things that you should do after you have deleted a WordPress theme:
- Make sure you delete any theme-associated media files. They are accessible from the media library in the WordPress admin dashboard.
- You should also check for any plugin dependencies. Some WordPress themes might ask you to install one or two plugins to access specific functionality. You might want to get rid of those plugins if they aren't needed now.
- You might also want to delete any widgets and menus that were specific to the old theme and are no longer useful to you.
This tutorial taught you three different ways of deleting a WordPress theme. The easiest and safest way of doing this is through the WordPress admin dashboard. However, you can also consider using other approaches if the admin dashboard isn't accessible to you for some reason.
It is also important to take a look around and see if your website needs further cleanup after you have deleted a theme. While deleting unused WordPress themes improves security and saves space, you should consider having at least one default backup theme to handle unforeseen circumstances.