Here’s a nightmare scenario that keeps too many WordPress site owners from properly maintaining their websites:
You log in to your WordPress dashboard and notice that an update is available for your theme. You know that updates are good and you want to keep your site secure, so you click the “upgrade” button and wait while WordPress does its thing.
Once the update is complete, you take a look at your site. That’s when you realize that something has gone terribly wrong. Your site is a mess, and all of the customizations you’ve made to your theme design are gone.
WordPress child themes eliminate this problem.
And yet, you don’t always need a child theme.
WP Apprentice members frequently ask me about child themes. I can tell by the nature of the questions that there’s an enormous amount of confusion surrounding the topic. In this article, I’ll explain the basics. By the end of this article, you’ll know what a child theme is and when you need one.
What is a WordPress child theme?
A child theme is a special kind of WordPress theme that inherits all of the design elements of its parent theme. A child theme with no customization is identical to its parent.
It works like this: you have a WordPress theme, but you want to make it your own by customizing it. You could modify the theme to meet your needs, but doing so creates a big problem in that WordPress themes are frequently updated. If you customize your theme, then update it, there’s a good chance that all of your changes will be lost.
You might think that you’ll just avoid updating your theme. Avoiding updates is a risky proposition. WordPress themes get updated for many reasons: to conform with new WordPress coding standards, to fix bugs, and to fix security issues.
Avoiding updates could break your site or even open you up to hacking. In other words, theme updates aren’t optional. If you want to maintain a secure and healthy WordPress site, you need to install theme updates as they become available.
By making changes to a child theme, you ensure that you can safely update your theme while maintaining site security and protecting your hard work.
When do I need a child theme?
Here’s the thing that causes the most confusion: You don’t always need a child theme.
So, how do you know whether or not you need a child theme? The answer depends on how you customize your theme.
Have you, or do you plan to, modify your theme’s underlying code? That includes any of the following:
- Edit the theme’s CSS stylesheet.
- Edit any of the theme’s PHP templates.
- Edit the theme’s functions.php file. Even just to add a single line of code.
If you answered yes to any of these questions, you need a child theme.
On the other hand, if your theme customizations are made exclusively through the WordPress dashboard, you don’t need a child theme. That includes changes made through the Theme Customizer (confusing, I know). The Theme Customizer doesn’t change your theme files.
Changes made through the Theme Customizer, or a theme settings page, are stored in a database. That means that theme updates won’t overwrite your changes.
How to make a child theme
For full instructions on setting up a child theme, see my post on how to make a WordPress child theme. You will need the following to set up your child theme.
- An FTP program. You use this to transfer files to your web server.
- FTP login credentials for your web server.
- A plain text editor (NOT a word processor).
Once you’ve got those lined up, you should be able to create a child theme in a matter of minutes.
Benefits of a WordPress child theme
Child themes add to the overall security of your website. They also make theme customization much easier. It’s possible to create a custom WordPress theme simply by modifying the CSS of your child theme. That makes theme customization accessible to designers who otherwise don’t code. Just remember to create your child theme first, then make changes to the child theme’s CSS file.
Child themes are also a great learning tool. When you’re just starting out working with WordPress themes, a child theme allows you to try all kinds of things without having to worry about breaking your theme. If things go wrong, you can get back to your original design simply by activating the parent theme.