What Is a WordPress Child Theme and When Do You Need One
A child theme keeps your code changes when the parent theme updates. When you need one, when you do not, and how to create a child theme in four steps.
On this page 7 sections
A WordPress child theme is a small theme that takes everything from another theme, the parent, and holds only your own changes. You need one when you edit theme files: templates, functions or stylesheets. You do not need one for changes made in the Customizer, in the theme options or in a page builder, because those are saved in the database and stay after an update.
This guide explains how a child theme works, when it is worth having, how to create one in four steps, and the mistakes that break sites.
We build WooCommerce themes at 8theme. Child themes are mentioned in about 6,000 of the 45,000+ topics in our support forum (counted in November 2026). That is roughly one topic in eight, which makes it one of the most common subjects there.
How a child theme works
- WordPress looks in the child theme first. If a template file exists in the child theme, WordPress uses it in place of the parent’s file with the same name.
- The functions file is added, not replaced. The child theme’s functions.php runs together with the parent’s.
- The child stylesheet comes last, so its rules win over the parent’s.
- An update touches only the parent. The update replaces the parent theme’s folder. The child theme’s folder is left alone.
That last point is the reason child themes exist. Edit a file in the parent theme, and the next update removes your edit.
When you need a child theme
| Change | Child theme needed? | Why |
|---|---|---|
| Colours, fonts and layout set in the Customizer or theme options | No | Saved in the database |
| Pages built with Elementor or WPBakery | No | Saved in the database |
| A few lines of CSS | No | Use Additional CSS in the Customizer |
| PHP snippets | Yes, or a code snippets plugin | The parent’s functions file is replaced by an update |
| Edited template files, including WooCommerce templates | Yes | Files in the parent theme are replaced by an update |
| A large custom stylesheet | Yes | Easier to keep and to version as a file |
If everything you changed is in the first three rows, you can skip the child theme. Our guide to editing CSS in WordPress covers the options without one.
How to create a child theme
Most premium themes ship a ready child theme, so check before you build one. XStore includes it in the theme package as the XStore-child folder, and it can also be downloaded from the Downloads page on 8theme.com; see the XStore documentation.
To make one by hand:
Step 1. Create a folder in wp-content/themes, for example mystore-child.
Step 2. Add a file named style.css with this header. The Template line must match the folder name of the parent theme exactly.
/*
Theme Name: My Store Child
Template: parent-theme-folder
*/
Step 3. Add a file named functions.php that loads the parent stylesheet. Many themes load their own styles for you, so read the theme’s documentation before you add this.
<?php
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
} );
Step 4. Upload and activate. Zip the folder and upload it under Appearance → Themes → Add New, or copy it by FTP. Activate the child theme. The parent theme must stay installed.
After activation, check the site. WordPress keeps Customizer settings per theme, so some themes need their options exported from the parent and imported into the child.
How to override a template
Copy the file from the parent theme into the child theme, keeping the same path, then edit the copy. WordPress will use it.
WooCommerce templates work the same way. Copy the file from the parent theme’s woocommerce folder, or from the plugin’s templates folder, into a woocommerce folder in the child theme.
Two rules save trouble later:
- Copy as few files as possible. Every copied template is now yours to maintain. After a WooCommerce update, open WooCommerce → Status and look for templates marked as outdated.
- Prefer hooks to copies. A few lines in functions.php that add or remove a block survive updates better than a copied template.
Common mistakes
- A wrong Template line. WordPress reports that the parent theme is missing. The line must be the parent’s folder name, not its display name.
- Copying the parent’s whole functions.php into the child. Both files run, the same functions are declared twice, and the site stops with a fatal error. Put only your own code in the child.
- Deleting the parent theme. The child cannot work without it.
- Editing the parent “just this once”. That edit is the one the next update removes.
- Copying every template “to be safe”. It freezes the theme at one version and hides the fixes that later updates bring.
- Forgetting the cache. A change in the child stylesheet may not show until the cache is cleared.
Before any theme update, read our guide to updating a WordPress theme without losing customizations.
Child themes and block themes
Block themes support child themes too. A theme.json file in the child theme changes colours, fonts and spacing, and template files in the child replace the parent’s. Templates edited in the Site Editor are saved in the database, so for small changes a block theme often needs no child theme at all.
FAQ
Do I need a child theme if I only use Elementor?
No. Pages built with Elementor, and settings made in the Customizer or theme options, are saved in the database. A theme update does not touch them.
Does a child theme slow down a site?
No. It adds one small stylesheet and whatever code you put in it.
Can I create a child theme after I have changed the parent theme?
Yes. Create the child theme, move your edited files and code into it, and restore the parent to its original state. Do it before the next update.
What happens to the child theme when the parent updates?
Nothing. The child’s files stay as they are. Test the store afterwards, because a template you copied may now differ from the parent’s new version.
Does XStore have a child theme?
Yes. XStore by 8theme comes with a ready child theme, XStore-child, in the theme package and on the Downloads page on 8theme.com.
Is a code snippets plugin an alternative?
For PHP snippets, yes. A snippets plugin keeps small pieces of code outside the theme. For template files and larger stylesheets, a child theme is the right place.















