A developer changed a few lines in your theme last year so the phone number sat beside the logo. This spring the theme updated itself, and the phone number went back to where it was. Nobody did anything wrong on the day. The change had simply been made in a place that updates overwrite.
That is the problem a WordPress child theme solves. It is also something many sites do not need at all, and setting one up on a live site without care can undo your settings. Working out which camp you are in takes a few questions, and doing it properly, if you need one, takes a little care.
What a WordPress child theme is
A child theme is a small, separate theme that borrows everything from another theme, the parent, and only holds your changes. In its simplest form it is a folder with one file, style.css, whose header names the parent theme. WordPress loads the parent first, then applies whatever the child adds or replaces.
The parent keeps receiving updates from its developer. The child is yours, so those updates never touch it. Any custom code inside it stays put while the parent changes underneath.
If you are still getting used to what a theme is responsible for, the plain introduction to WordPress themes is a good place to begin.
Why theme updates remove hand edits
An update deletes the theme’s old files and puts the new version’s files in their place. If someone edited header.php or the theme’s stylesheet directly, through the Theme File Editor (under Appearance on classic themes, Tools on block themes) or over FTP, that edit lived inside those files and goes when they are replaced.
Settings you choose in screens are a different matter. The Customizer, the Site Editor and a theme’s options panel store their choices in the database, not in theme files, so updates leave them alone. Our post on updating a theme without losing changes explains how to check where your existing edits are before you update.
Do I need a child theme?
Ask what kind of changes your site has, or will have.
You need one when
- Someone is changing the theme’s PHP template files, for example to move an element in the header or alter how a blog post is laid out.
- You want to override one of the theme’s template files with your own version.
- You have a large amount of custom CSS that a developer looks after and wants in a proper file.
You probably do not when
- All your changes are made in the Customizer or the theme’s own options. These are already safe from updates.
- You use a block theme and make changes in Appearance → Editor. Template and style edits made there are saved in the database.
- Your extra styling is a few lines in the Additional CSS box. Our guide to adding custom CSS shows where that goes.
- Your pages are designed in a page builder, which stores its layouts in the database too.
- The only code you add is small functions. A snippets plugin is often a better home than any theme file, as our comparison of Code Snippets and functions.php explains.
Block themes can have child themes as well, and the Create Block Theme plugin from the WordPress team can make one. For most owners on a block theme, though, the Site Editor removes the reason to.
Setting one up carefully
There are three ways, from easiest to most hands-on.
Use the theme maker’s own child theme. Many popular themes offer a ready-made child theme to download from their website or documentation. This is the safest option because it is built to match the parent.
Use a child-theme generator plugin. Several plugins in the WordPress.org directory create the folder and files for you. Once the child theme exists you can usually remove the plugin.
Make it by hand. This is the route developers take:
- Find the parent theme’s folder name in
wp-content/themes. It is often lower case, for exampleastra, and may differ from the name shown in the dashboard. - Create a new folder beside it, such as
astra-child. - In that folder, create
style.cssstarting with a comment block that includesTheme Name: Astra ChildandTemplate: astra. The Template line must match the parent’s folder name exactly. - Check the parent theme’s documentation on stylesheets. Some parents load the child’s stylesheet automatically; others expect a small
functions.phpin the child that loads the parent’s styles. - Compress the folder into a zip file, then go to Appearance → Themes, press Add Theme (Add New on older versions) and use Upload Theme. Do not activate it yet.
The catch when you activate the child theme
People are most often caught out here. Customizer settings are saved per theme, and WordPress treats the child as a different theme from its parent. When you activate the child, the colours, header layout, logo and other Customizer choices you made on the parent may not appear. Menu locations need assigning again, and the Additional CSS box starts empty too, because that CSS is also stored per theme.
Nothing is lost. Switch back to the parent and the settings return. To bring them across, either note them and re-enter them in the child, or use a Customizer export and import plugin. Some themes keep their options globally and are not affected, but you only find out by testing.
So do the switch on a copy of the site first. Our article on setting up a staging site covers how. On staging, activate the child, put the settings back, compare the pages with the live site, then repeat on live at a quiet time.
Mistakes to avoid
- A typo in the Template line. WordPress then lists the child under Broken Themes and says the parent theme is missing.
- Deleting the parent. The child cannot work without it. Both must stay installed, with only the child active.
- Copying the whole parent into the child. Every file copied stops receiving the parent’s fixes. Copy only the files you actually change.
- Editing the child’s PHP live in the dashboard. One missing bracket in
functions.phpcan take the site down. Edit on staging, or with file access ready to undo. - Forgetting to tell the next developer. Write down that a child theme exists, which files it changes and why.
Child themes are one small corner of looking after a site; updates, users and backups sit alongside them in our handbook on managing your WordPress site, written for owners rather than developers.
Frequently asked questions
Does a child theme slow down a website?
Not in any way a visitor would notice. A basic child theme adds one small stylesheet and perhaps a few lines of code. Speed problems come from what the parent theme and plugins load, not from the existence of a child theme. A child theme stuffed with large copied files is a different matter, which is another reason to keep it small.
My developer already edited the parent theme. Can I still add a child theme?
Yes, but do it before the next update. Compare the edited files with a fresh copy of the same theme version so you can see which lines differ, carry those differences into a new child theme, test it on staging, and only then update the parent. Updating first would wipe the edits you are trying to rescue.
Does the child theme get updates too?
No. The child theme is your own code, so nobody publishes updates for it. The parent keeps updating as normal. If your child theme overrides a template file, check that file after major parent updates, because the parent’s newer version may include fixes your copy does not have.
Do I need a child theme if my site is built with Elementor?
Usually not for page designs, because Elementor saves its layouts in the database rather than in theme files. You would only need one if someone also changes the theme’s own PHP files or wants a home for a large custom stylesheet. Many Elementor sites run a light theme and never touch its files.
Rescuing edits from a parent theme is fiddly, and one slip in functions.php shows on every page. Setting up a child theme is part of what our theme customization service does, with testing on a backup or staging copy where possible before anything goes live.
Next in this series: How to Change Fonts in WordPress (Block and Classic Themes)