You might be changing your WordPress theme often. While doing this, do you delete the old WordPress them? If no start deleting after you are sure that you won’t switch back to it.
It is a good practice to remove themes or plugins that you aren’t using from your site as this will improve your site’s security and could also improve its performance. In this guide, you will learn about the methods for deleting a WordPress theme in a safe and proper way.
Scenarios in which You Might Want to Delete the Theme
Below are a few scenarios in which you might want to delete a WordPress theme:
- When you install a new WordPress theme and want to get rid of the old one.
- A theme is installed for testing but later decided it isn’t a good fit.
- You are not using the default theme and want to remove it from the WordPress installation.
May it be any scenario; the way in which you delete the theme is same.
Reasons to Delete Unused WordPress Themes
You might not think of deleting the unused theme as it’s not harming your site or you may want to use it in future.
Remember it is always good to remove any code that isn’t used from your WordPress installation and this is applicable to plugins and themes.
Check below the reasons to delete themes and plugins that aren’t being used:
- Security: The number of themes installed increases the opportunities for a hacker to infiltrate your site.
- Updates: There isn’t the need to keep a theme you’ve deleted up to date. You will be excited to skip the updates for an inactive theme on your site, but for security reasons, it’s important to update inactive themes and plugins similar to the active ones.
- Performance: The admin dashboard, the backend of your WordPress site, is the main area that can get affected due to inactive themes. This is because of out dated inactive themes. When you update the themes in WordPress, it will query every theme installed, active or inactive, to check if there is an update. Though it seems nominal, checking for updates for more than 10 inactive themes adds up to more wok. In most cases, the frontend of your WordPress site, is served from cache and won’t be impacted by inactive themes.
- Space: Every file that isn’t used takes up valuable space on your hosting plan. This can affect your website performance or could end up burning your pockets for a more expensive plan.
- Database Performance: In case a theme is inactive and it has added data to the database when it was active, that data remains stored in the database if you want to activate it again. If you delete the theme, the data will be removed.
Deleting and Uninstalling a Theme – What’s the Difference?
Uninstalling and deleting a theme seems to be similar when it comes to the theoretical part. Practically in both cases, the code files will get deleted from the server when the theme. There are some cases, when a theme is just uninstalled, some of the related content remains as is. You will learn this later in this guide.
You should also understand the difference between deleting or uninstalling a theme vs deactivating it.
It’s simple that a theme gets deactivated automatically, if you activate another theme. But in case of plugins, you have to manually deactivate any plugin that you want to stop running. The reason is that only one theme can stay active on a site.
So, when the current theme is deactivated by activating a new theme, the new theme becomes active but the old theme remains as is in the system. The settings you configured are stored in the database in case you want to activate the theme later (which saves your rework). The widgets that you added to widget areas in your inactive theme remain saved but get moved to the Inactive Widgets section of the Widgets screen. The menus that you added to the theme are stored but you need to specify the area in the new theme to place them.
For permanent removal of a theme and all its settings, you need to delete it. To know how to delete a theme, keep reading on!
When You Shouldn’t Delete a WordPress Theme?
Sometimes there are situations when a theme isn’t active on your site but you still mustn’t delete it. These are:
- If it is a parent theme for the currently active theme.
- Your site is based on a Multisite network and the theme is active on another site in the network.
- You want the theme for testing or for reactivation after testing the current theme.
Parent Themes
When a theme is used as a parent theme, it won’t be active on your site. But the child theme won’t work without it.
You will know if the active theme is a child theme in the Themes screen as below:
Prior to deleting an inactive theme on your site, check the active theme: is it using a parent theme? If it is, don’t delete that theme!
WordPress Multisite
In case your site is a part of WordPress Multisite network and you just have the administrator privileges for the site, you won’t be able to delete or install themes. The reason is that only the user who can manage themes is the network administrator.
It is possible to check if your site is part of network by viewing the admin bar at the top. If you see My Sites, then this is a network instead of a standalone site:
In WordPress Multisite, you aren’t permitted to install or delete themes. But you can activate themes that are installed on the network by the network admin.
In case, you are a network admin and have deactivated a theme on one of your own sites in the network, make sure that you delete a theme that you aren’t using at all. Another use might have activated that theme on his site.
This doesn’t mean it isn’t worth to clean up your themes (and plugins) on time and remove those that aren’t being used on the network. Installing the Multisite Enhancements plugin and network activating it, helps to check which themes are being used across your network. This will add a column to the Themes and Plugins screens in the network admin, indicating which themes and plugins are active on different sites in your network.
Testing Themes
You might have installed a theme for testing purposes. For testing a new theme on your site, you can use a staging site. But if it’s not possible, you can install the theme for testing purposes.
If you are one of the team members and want to delete a theme, check with your colleagues first. In case you are testing a theme and you might need to reactivate it in future, don’t delete it.
What Should You Do Before You Delete a WordPress Theme?
Until now, you might have checked the theme isn’t being used; it isn’t a parent theme and won’t be needed to reactivate in future. Finally, you want to delete it.
Prior to moving further and deleting it, hang around. Now, you should do one or both the things: test the site by deleting the theme on your staging site and take the backup. If you are on Multitsite, you can use the Multisite backup plugins.
Staging Sites
A staging site is actually a mirror of your live site on the same server. With staging, you can easily make a copy of your site and then use that for testing.
In case, you don’t get an access to your staging site, it is better to delete the theme on that site first so that you get assured that there won’t be any issues. If the deleted theme turns out to be the parent theme for the active theme, you will criticize yourself but if it’s not, you will be relieved.
Backing Up
Prior to deleting anything from your site, ensure that you take a backup first, similar to when you would before running an update.
MilesWeb’s automatic website backup feature (paid) helps you to quickly take a backup prior to deleting that theme and then restore it instantly when required.
Don’t ever skip this step.
How to Delete a WordPress Theme?
After checking that you can safely delete your theme and you’ve taken a backup, it’s time to delete that theme.
You can delete the theme in the below three ways:
- Via the WordPress dashboard
- Using FTP/SFTP
- Using WP-CLI
Let’s check each of these in turn.
1. Steps to Delete a WordPress Theme via the WordPress Dashboard
It is very easy to delete a theme via the WordPress dashboard. This way is recommended, if you have an access to the admin screens.
In your WordPress site, navigate to Appearance > Themes. Here, you will see all of your installed themes displayed with the active one first in the list.
From the list, click on the theme that you want to delete for checking its details.
You will see the Delete link in the lower right-hand corner. Click on it and WordPress will ask if you really want to delete the theme. Click the OK button in the popup and the theme will be deleted.
2. Deleting a WordPress Theme via FTP/SFTP
In case you aren’t allowed to access the WordPress dashboard, but have an access to the site via FTP/SFTP, it is possible to delete the folder that contains the theme.
This can be done via your FTP client. Open your FTP client and go to the wp-content/themes directory on your site.
This directory comprises of list of all the installed themes. You can’t detect which one is active and so this can be the riskiest method of deleting a theme and hence, you should take a backup first. But if the theme itself is broken and isn’t letting you access the admin screens, this may be your only option.
Go to the folder containing the theme you want to delete and right-click on it to access a shortcut menu (most FTP clients will allow you do this but yours might be a somewhat different).
Click on Delete in the shortcut menu. You will be asked for the confirmation to delete the folder by the FTP client.
Select Yes or OK. The theme will then be deleted.
3. Deleting a Theme via WP-CLI
Deleting a theme via WP-CLI is the third and quickest option to use if you know how to manage your site via the command line. In case you haven’t used WP-CLI before, this is probably not the best time to start, because if there’s a mistake, you might delete the wrong files.
At first, access your site via the command line using WP-CLI.
To check a list of all of your installed themes, run the below code:
$ wp theme list
After this, you will be given a list of all of your installed themes. For more detailed information, you can request a list of inactive themes by using the below code:
$ wp theme list --status=inactive
With this, a list of all the inactive themes will get displayed so you know which ones are safe to delete (except one is a child theme or active on another site in a Multisite network).
To delete the theme, run the below code:
$ wp theme delete twentyseventeen
Note: The final parameter is the name of the theme’s folder and not the name of the theme as you see it in the admin screens.
Then a message will get displayed telling you the theme has been deleted:
Deleted 'twentytwelve' theme. Success: Deleted 1 of 1 themes.
If you can use WP-CLI, this is the fastest way to delete a theme, but there are some risks with it. You don’t have the information about the theme which you get in the admin screens, you can easily delete the wrong theme. So stay alert and test on your staging site first and remember to take a backup.
Testing Your Site After Deleting a Theme
After deleting your WordPress theme, don’t miss to test your site. Clear the cache first and browse the site. Check that everything’s working properly.
In case you accidentally deleted the parent theme of the active theme, some or maybe all of the CSS will be missing, means your site will look unstyled. In case you accidentally deleted the active theme, WordPress will have found another theme to use instead (it will assume that you have another one installed).
After accidentally deleting a theme, reinstall it. This is possible via the Themes screen if you originally got the theme from the theme directory or by uploading the theme again from the backup that you took prior to deleting the theme.
Deleting Theme-related Content
After deleting the theme, you may find that there is still content on your site that’s related to the theme you deleted.
It might include:
- Widgets
- Menus
- Dummy content such as posts, pages, or posts of a custom post type if the theme registered one
- Images
For cleaning your site and helping it perform, it is better to either delete this content or reassign it so it works in your new theme.
Widgets
Widgets work only after adding them to widget areas. If there were widgets in a theme that you deactivated, those will present in the Inactive Widgets area of the Widgets screen.
To include those widgets in your new theme, drag them to the widget areas. You can delete them, if you aren’t going to need them. Those can be deleted individually or you can just click the Clear inactive widgets button to remove them all.
Menus
In all themes, you will get at least one location to place a menu, generally in or right below the header. Some themes have extra menu locations in the footer or sidebar areas.
After activating a new theme, the menu you created for your old theme will still be available but you’ll have to inform WordPress which menu location you want for each menu.
In case you were using multiple locations for your menu in your previous theme and your new theme doesn’t have multiple navigation locations, the Custom Menu widget can be used to add any menus to a widget area in your footer or sidebar.
Dummy Content
In case, you uploaded or imported dummy content to test your theme, you’ll need to remove that from your site.
You can remove any posts and pages that were added after you delete the theme, from the Posts and Pages screens in the WordPress admin. Or you can keep them as they are for using in the new theme.
If your previous theme has registered a custom post type (which isn’t good: this should be done using a plugin), then you will need to delete any posts of that custom post type except if your new theme also registers the same custom post type or (better)a plugin is added for doing it.
Any posts of a custom post type need to be deleted prior to deleting the old theme as you won’t be able to view them after the code registering the custom post type is deleted.
Images
The image settings vary for different themes. Some use more featured images than others and some have extra media sizes to adjust with the theme’s layout.
You also might have uploaded images for using in a slider or carousel that was included with the theme.
When you delete your theme, it’s a good idea to clean up your images. This can be done in two ways:
- Resize images to adjust with the new theme settings.
- Remove unused images.
For resizing images, install the Regenerate Thumbnails plugin.
After installing and activating it, go to Tools > Regenerate Thumbnails.
On this screen, click the Regenerate Thumbnails for All X Attachments button, where X indicates the number of images present on your site.
The plugin will regenerate your images and create new ones of any custom sizes registered by your theme. You will also be asked if you want to delete any images in sizes that aren’t used since long time. Select this option.
In case you uploaded images for a slider or some other feature of the previous theme, the Regenerate Images plugin will remove the images in sizes that are aren’t needed by the new theme but would keep the original uploaded image files.
In the WordPress admin, go to Media Library and identify any images that you don’t need before deleting them permanently. An alternate solution is to do this prior to deactivating the old theme, from the admin screen for any slider or carousel that the theme included. The exact process of doing this will depend on the configuration of theme settings.
Bottom Line
To delete a WordPress theme isn’t just as simple as going to the Themes screen and clicking Delete.
It is important to ensure that you delete a theme safely and carefully. Take the extra steps such as taking a backup, dealing with any content from the old theme and testing on your staging site first as it will help your site to run smoothly with your new theme. Just follow the above steps so that you can make it work easily.
Also Read:
How To Install WordPress Theme?
Why My WordPress Theme Is Not Showing?