From time to time, you’ll find yourself switching to a new WordPress theme on your site. When you do this, it’s a good idea to delete the old WordPress theme, once you’re sure you won’t be switching back to it.
Removing themes or plugins that you aren’t using from your site is good practice: it’ll make your site more secure and could make it faster. In this guide, I’ll show you the methods you can use to delete a WordPress theme so that you know how to do it safely and thoroughly.
- When You Might Want to Delete a WordPress Theme
- When Not to Delete a WordPress Theme
- Things to Do Before You Delete a WordPress Theme
- How to Delete a WordPress Theme
- Deleting Theme-related Content
When You Might Want to Delete a WordPress Theme
There are a few scenarios in which you might find yourself wanting to delete a WordPress theme:
- You’ve installed a new WordPress theme and want to get rid of the old one.
- You installed a theme for testing but then decided it wasn’t for you.
- You’re not using the default theme and want to remove it from your WordPress installation.
The way in which you delete the theme is the same whatever scenario you’re in.
Why It’s Best Practice to Delete Unused WordPress Themes
You might be tempted to hang onto that theme you aren’t using anymore: after all, it’s not doing any harm, and you might decide to use it again in the future.
But it’s good practice to remove any code you aren’t using from your WordPress installation and this applies to themes and plugins.
Reasons why you should delete themes and plugins that aren’t being used include:
- Security: the more themes you have installed, the more opportunities there are for a hacker to infiltrate your site.
- Updates: you don’t have to keep a theme you’ve deleted up to date. It can be tempting to skip updates for an inactive theme on your site, but for security reasons, it’s just as important to update inactive themes and plugins as it is active ones.
- Performance: the more files you have sitting in your WordPress installation, the more chance that they’ll be slowing down your site. A theme that isn’t active shouldn’t affect site performance if it’s well-coded, but if it isn’t so well-coded, well, it definitely will.
- Space: every file you aren’t using is taking up valuable space on your hosting plan. This could lead to performance issues or could end up costing you more for a more expensive plan.
- Database performance: if a theme is inactive and it has added data to the database when it was active, that data will still be stored in the database in case you should activate it again. If you delete the theme, the data will be removed.
Deleting vs Uninstalling a Theme
In theory, installing a theme vs deleting it should be the same thing. In both cases, the code files for the theme will be deleted from the server. In both cases, any data should also be deleted. But in some cases, simply uninstalling a theme might not remove all of the related content. We’ll look at how to do that later in this guide.
It also pays to understand the difference between deleting or uninstalling a theme vs deactivating it.
A theme is deactivated if you activate another theme instead. Unlike with plugins, where you have to manually deactivate any plugin you don’t want running, the process is automatic. This is because only one theme can be active on a site.
So when you deactivate the current theme by activating a new theme instead, the new theme becomes active but nothing from the old theme is removed from the system. Any settings you configured are kept in the database in case you should activate the theme again (which saves you having to do the work again). Any widgets you added to widget areas in your theme are saved but moved to the Inactive Widgets section of the Widgets screen. And any menus you added to the theme are kept, but you have to specify where in the new theme you want them to appear.
If you want to permanently remove a theme and all its settings etc., you need to delete it. To learn how to do that, read on!
When Not to Delete a WordPress Theme
There are times when a theme might not be active on your site but you still mustn’t delete it. These include:
- The theme is a parent theme for the currently active theme.
- Your site is on a Multisite network and the theme is active on another site in the network.
- You need to keep the theme for testing or for reactivation after testing the current theme.
A theme being used as a parent theme won’t be active on your site, but without it, the child theme will break.
WordPress will inform you if the active theme is a child theme in the Themes screen:
Before you delete an inactive theme in your site, check the active theme: is it using a parent theme? If so, don’t delete that theme!
If your site is part of a WordPress Multisite network and you only have administrator privileges for the site, then you won’t be able to delete (or install) themes. This is because the only user who can manage themes is the network administrator.
You can check if your site is part of a network by looking at the admin bar at the top. If there’s a My Sites item, then this is a network rather than a standalone site:
You won’t be able to install or delete themes, but you will be able to activate themes that have been installed on the network by the network admin.
If you are the network admin and you’ve deactivated a theme on one of your own sites in the network, beware deleting a theme you’re no longer using. There could be another user who’s activated that theme on their site.
This doesn’t mean it isn’t worth cleaning up your themes (and plugins) from time to time and removing those that aren’t being used on the network. To see which themes are being used across your network, you can install the Multisite Enhancements plugin and network activate it. It will add a column to the Themes and Plugins screens in the network admin, telling you which themes and plugins are active on the various sites in your network.
Sometimes you or a colleague may have installed a theme for testing purposes. If you want to test a new theme on your site, the best way to do it is by using a staging site. But if this isn’t an option, you may decide to install a theme for testing purposes.
If you’re working as part of a team and are planning on deleting a theme, always check with your colleagues first. And if you’ve been testing a theme and there’s a chance you might need to reactivate it in future, then don’t delete it.
Things to Do Before You Delete a WordPress Theme
So you’ve checked the theme isn’t in use, it isn’t a parent theme, and it won’t need to be reactivated in future. You know you want to delete it.
Before you go ahead and delete the theme, hold your horses. Now’s the time to do one or both of two things: to test the site with the theme deleted on your staging site and to take a backup. If you’re on a multisite install, here’s a guide for Multisite backups plugins.
A staging site is a mirror of your live site on the same server. All Kinsta hosting plans come with a free staging site and you can easily make a copy of your site and then use that for testing.
If you do have access to your staging site, it’s good practice to delete the theme on that site first, so you can be 100% sure it doesn’t cause any problems. This is when you will curse yourself if it turns out the deleted theme was the parent theme for the active theme and then breathe a sigh of relief when you realize you didn’t delete it on your live site.
Before you delete anything from your site, take a backup first, just as you would before running an update.
If you don’t have one-click backups as part of your hosting plan, you can install a backup plugin and use that.
Either way, don’t skip this step.
How to Delete a WordPress Theme
So you’ve checked that your theme is safe to delete and you’ve taken a backup. Now it’s time to delete that theme.
There are three ways you can do this:
Let’s take a look at each of these in turn.
1. Deleting a WordPress Theme via the WordPress Dashboard
Deleting a theme via the WordPress dashboard is the simplest way to do it. If you have access to the admin screens, then this is the recommended way.
In your WordPress site, go to Appearance > Themes. You’ll see all of your installed themes displayed with the active one first in the list.
From the list, click on the theme you want to delete to view its details.
In the lower right-hand corner, there’s a Delete link. Click on that and WordPress will check 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
If you don’t have access to the WordPress dashboard, but do have access to the site via FTP/SFTP, you can delete the folder with the theme in.
You can do this via your FTP client. Open your FTP client and navigate to the wp-content/themes directory on your site.
You’ll see all of the installed themes listed. You have no way of knowing which one is active so this can be the riskiest method of deleting a theme and is why it’s important to take a backup first. But if the theme itself is broken and is preventing you from accessing the admin screens, this may be your only option.
Hover your mouse over the folder containing the theme you want to delete and right-click on it to access a shortcut menu (most FTP clients will let you do this but yours might be a little different).
Click on Delete in the shortcut menu. Your FTP client will ask you to confirm that you really want to delete the folder. Select Yes or OK. The theme will then be deleted.
3. Deleting a Theme via WP-CLI
Using WP-CLI is the third and quickest option to use if you’re familiar with using the command line to manage your site. If you haven’t used WP-CLI before, this is probably not the best time to start, as if you make a mistake, you could delete the wrong files.
Start by accessing your site via the command line using WP-CLI.
To see a list of all of your installed themes, type the following:
$ wp theme list
You will then be given a list of all of your installed themes. If you want to get more useful information, you can request a list of inactive themes:
$ wp theme list --status=inactive
You will then see a list of all the inactive themes, so you know which ones are safe to delete (unless one is a child theme or active on another site in a Multisite network).
To delete the theme, type in the following:
$ wp theme delete twentyseventeen
Note that the final parameter is the name of the theme’s folder, not the name of the theme as you would see it in the admin screens.
You will then see a message telling you the theme has been deleted:
Deleted 'twentytwelve' theme. Success: Deleted 1 of 1 themes.
If you’re familiar with using WP-CLI, this is the fastest way to delete a theme, but it comes with risks. Because you don’t have the information about the theme you’d get in the admin screens, it is easier to delete the wrong theme. So be careful, test on your staging site first and make sure you have a backup.
Testing Your Site After Deleting a Theme
Once you’ve deleted your WordPress theme, it’s important to test your site. Visit it in a browser, making sure you clear the cache and check that everything’s working as it should.
If you accidentally deleted a theme that’s a parent of the active theme, you’ll find that some or maybe all of the CSS is missing, meaning your site will look unstyled. If you accidentally deleted the active theme, WordPress will have found another theme to use instead (assuming you have another one installed).
If you accidentally deleted a theme, you’ll need to reinstall it. You can do this via the Themes screen if you originally got the theme from the theme directory or by uploading the theme again from the backup you took before you began.
Deleting Theme-related Content
Once you’ve deleted the theme, you may find that you still have content on your site that’s specific to the theme you deleted.
This might include:
- Dummy content such as posts, pages, or posts of a custom post type if the theme registered one
To clean up your site and make it perform as well as possible, you should either delete this content or reassign it so it works in your new theme.
Widgets only work when they’re added to widget areas. If there were widgets in a theme you deactivated, you can find them in the Inactive Widgets area of the Widgets screen.
Drag these to the widget areas in your new theme or delete them if you no longer need them. You can delete them individually or click the Clear inactive widgets button to remove them all.
All themes contain at least one location for you to place a menu, normally in or right below the header. Some have extra menu locations in places like the footer or sidebar.
When you activate a new theme, the menu you created for your old theme will still be available to you but you’ll have to tell WordPress which menu location you want each menu to appear in.
If you were using multiple menu locations in your previous theme and your new theme doesn’t have extra navigation locations, you can use the Custom Menu widget to add any menu to a widget area in your sidebar or footer.
If you uploaded or imported dummy content to test your theme, you’ll want to remove that from your site.
Any posts and pages you added can be removed after you delete the theme, from the Posts and Pages screens in the WordPress admin. Or you can leave them where they are for use in the new theme.
If your previous theme registered a custom post type (which isn’t good practice: you should do this via a plugin), then you’ll need to delete any posts of that custom post type, unless your new theme also registers the same custom post type or (better) you add a plugin that does it.
You’ll need to delete any posts of a custom post type before deleting the old theme as you won’t be able to see them once the code registering the custom post type is gone.
Different themes have different image settings. Some use featured images more than others and some have additional media sizes to fit with the theme’s layout.
You also might have uploaded images for use in a slider or carousel that was included with the theme.
After deleting your theme, it’s a good idea to clean up your images. There are two aspects to this:
- Resizing images to fit with the new theme settings.
- Removing unused images.
To resize images, install the Regenerate Thumbnails plugin.
Once it’s installed and activated, go to Tools > Regenerate Thumbnails.
On the regenerate thumbnails screen, click the Regenerate Thumbnails for All X Attachments button, where X is the number of images you have in your site.
The plugin will regenerate your images for you, creating new ones of any custom sizes registered by your theme. It will also ask you if you want to delete any images in sizes that are no longer used. You should select this option.
If you uploaded images for a slider or some other feature of the previous theme, the Regenerate Images plugin will often remove the images in sizes that are no longer needed by the new theme but it won’t remove the original uploaded image files.
Go to Media Library in the WordPress admin and identify any images you no longer need before deleting them permanently. Alternatively, you could do this before deactivating the old theme, from the admin screen for any slider or carousel that the theme included. Exactly how you do this will depend on how the theme settings are configured.
Deleting a WordPress theme isn’t just a simple matter of going to the Themes screen and clicking Delete.
It’s important to make sure you delete any theme safely and thoroughly. Extra steps such as taking a backup, testing on your staging site first, and dealing with any content from the old theme will help your site to run smoothly with your new theme. Follow the steps above and you’ll be able to do it properly.
The post How to Delete a WordPress Theme (3 Effective Ways) appeared first on Kinsta Managed WordPress Hosting.