Setup & site building · Guide
How to Create a Child Theme in WordPress

Short answer
Create a folder in wp-content/themes, add a stylesheet whose header names the parent theme in the Template line, and add a PHP file that loads the parent stylesheet. Then activate the child theme under Appearance, then Themes. WordPress uses the child files you add and falls back to the parent for everything else.
Key takeaways
- A child theme extends a parent theme without editing the parent's files.
- The Template line in style.css must match the parent theme's folder name.
- A theme update replaces the whole parent theme, so edits inside it are lost.
- Load parent styles with wp_enqueue_style, not with @import.
- WordPress uses a child template copy first and falls back to the parent.
What is a child theme?
A child theme is a theme that extends a parent theme, so you can change the design or add features without editing the parent theme's files.
The Theme Handbook's child themes page states that child themes let you modify an existing theme without directly editing that theme's code, from a few color changes to full template overrides.
When the child theme is active, WordPress uses the parent theme for everything the child does not replace. The child holds only your changes, and the parent holds everything else.
The guide to what a child theme is covers the same idea in more detail. This guide shows how to build one.
A child theme is a normal theme in the admin area. It appears under Appearance, then Themes, and you activate it the same way as any other theme.
When should you use a child theme?
Use a child theme when your changes must survive parent theme updates.
Learn WordPress's child themes lesson explains that a theme update replaces the whole theme, so any file you edited inside the parent theme is lost. That loss is the whole problem a child theme solves.
That makes a child theme the right home for custom CSS, changed templates, and small PHP additions. If you plan to keep the parent theme updated, and you plan to change how it looks or works, build the child theme first.
If the change is a few CSS rules only, the Customizer's Additional CSS field may be enough. The guide to adding custom CSS in WordPress covers that route, and it needs no files at all.
For a block theme, many changes can live in the Site Editor instead. The child theme route suits changes you want to reuse on another site, or keep in files you can copy and back up.
Do not build a child theme for a theme you wrote yourself and control fully. A child theme adds value when the parent belongs to someone else and will receive updates.
What do you need before you start?
You need the parent theme installed, a way to edit files, and the parent theme's folder name.
File access can be SFTP, your host's file manager, or a local copy of the site. The WordPress admin area alone cannot create the folder, so you need one of those routes.
Find the parent folder name under wp-content/themes, since the child theme must name that exact folder. The folder name is often all lowercase with no spaces, such as twentytwentyfour.
Note the parent theme's display name as shown in Appearance, then Themes, and its folder name, since the two can differ. The folder name is the one that matters for the child theme header.
Pick a folder name for the child theme, such as twentytwentyfour-child for the Twenty Twenty-Four theme. The exact name is yours to choose, as long as it has no spaces.
| File | Purpose |
|---|---|
| style.css | Theme header and your CSS; required |
| functions.php | Enqueue styles and add small PHP features |
| footer.php, header.php | Copies of parent templates you want to change |
| theme.json | Style settings for a block theme child |
Keep the folder small at first. A style.css file and a functions.php file are enough to start, and you add template copies only when you need them.
How do you create the child theme folder and style.css?
Create a folder in wp-content/themes, add a style.css file, and put a header at the top that names the parent theme.
Follow these steps:
- In wp-content/themes, create a new folder, for example twentytwentyfour-child.
- Inside it, create a file named style.css.
- Add the header below, with Template set to the parent theme's folder name.
- Save the file.
/*
Theme Name: Child theme of Twenty Twenty-Four
Template: twentytwentyfour
*/
Learn WordPress's lesson states that the Template field must match the folder name, or slug, of the parent theme, relative to the wp-content/themes directory. That match is the link between the two themes.
Theme Name can be anything clear. Template is the line WordPress reads to find the parent, so a typo there means the child theme will not load the parent at all.
Add your own CSS below the header, in the same style.css file. Rules you add there apply after the parent styles, so they can change colors, sizes and spacing.
The header above comes from Learn WordPress's child themes lesson, which builds a child theme of Twenty Twenty-Four step by step. Change the names to match your own parent theme.
How do you load the parent theme styles?
Add a functions.php file that hooks into wp_enqueue_scripts and loads the parent stylesheet with wp_enqueue_style.
Load styles with the enqueue system, not with @import in the stylesheet. The enqueue system loads styles in the right order, and it lets WordPress track which styles a page uses.
Add this code to functions.php in the child theme folder:
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style' ) );
}
Learn WordPress's including assets lesson explains that styles and scripts are added with the wp_enqueue_scripts action hook, and that get_template_directory_uri() with style.css makes the CSS available on the front end.
The second wp_enqueue_style call loads the child stylesheet after the parent one, with the parent listed as a dependency. That order is what lets your rules override the parent rules.
WP-CLI can create the whole starter set for you. Its scaffold child-theme reference states that wp scaffold child-theme creates a child theme folder with functions.php and style.css files. Run it from the site root:
wp scaffold child-theme sample-theme --parent_theme=twentysixteen
The command takes the new theme slug and the parent theme slug, and it writes both files for you. Activate the result under Appearance, then Themes.
How do you activate the child theme?
Go to Appearance, then Themes, find the child theme, and click Activate.
The child theme appears in the list once the folder and style.css are in place, even before you add any CSS. If it does not appear, check that style.css sits in the folder root, not in a subfolder.
After activation, the site should look the same as before, since the child theme inherits everything from the parent. Learn WordPress's lesson notes that the front end looks exactly the same at this point, because all the theme parts come from the parent.
Check the front end after activation, then add your changes one at a time so a mistake is easy to trace. A broken rule in the child stylesheet is easier to find when it is the only change you made.
If the site looks broken after activation, the parent styles are likely not loading. Check the functions.php enqueue code first, and confirm the Template line matches the parent folder name.
How do you override a template file?
Copy the parent template file into the child theme at the same path, then edit the copy.
WordPress looks in the child theme first and uses the child copy when one exists, so the parent file stays untouched. Learn WordPress's lesson shows the same rule with a footer file: changes made to footer.html in the child theme are applied, and the parent file is left alone.
Copy only the files you plan to change. The rest keeps loading from the parent, which keeps the child folder small and easy to review.
For a classic theme, copy a file such as footer.php or header.php. For a block theme, copy the matching .html template, as the next section shows.
If a parent update changes a template you copied, compare the new parent file with your copy and carry over any fixes you still need. A stale copy can miss a security fix or a new feature from the parent.
Keep a note of which files you copied and why. When the parent theme updates, that note tells you which copies to review first.
How do you make a child theme for a block theme?
Edit the templates in the Site Editor, then use the Create Block Theme plugin to save those changes as a child theme.
Learn WordPress's child themes lesson describes the flow: make the changes in the Site Editor, open the Create Block Theme options, choose Create Child Theme, name it, and click Create Child Theme.
The plugin creates the child theme files and activates the new theme, so the Site Editor changes live in files you can copy to another site.
The same lesson notes that a child theme can extend template parts, patterns, styles, and custom theme features, not just templates. A block theme child can therefore carry most of your design work.
For a block theme, the file to override is an .html template such as footer.html, placed in the child theme at the same relative spot as in the parent. Edit the file in the Site Editor first, then copy the result into the child folder if you prefer files.
You can install the plugin from the WordPress.org plugin directory: search for Create Block Theme under Plugins, then Add New. The Make WordPress Themes post on Create Block Theme describes the plugin as a tool that creates a child theme with the active theme as its parent.
The guide to block themes vs classic themes explains which kind of theme you run.
The guide to using the WordPress Site Editor shows how to open and edit templates.
What mistakes should you avoid?
Do not edit the parent theme, do not use @import for parent styles, and do not set Template to the theme's display name.
Other mistakes to avoid:
- Editing files inside the parent theme folder, where the next update erases the work.
- Setting Template to the display name, such as “Twenty Twenty-Four”, instead of the folder name twentytwentyfour.
- Loading the parent stylesheet with @import, which the enqueue system replaces.
- Copying every parent template into the child theme, which turns the child into a full copy that misses parent updates.
- Activating the child theme on a live site without checking the front end first; test on a staging copy when you can.
A child theme with only the files you changed is easy to maintain. A child theme that copies the whole parent is hard to update, and it defeats the purpose of the split.
Frequently asked questions
Do I need a child theme to change my theme's colors?
Not always. A few CSS rules can go in the Customizer's Additional CSS field, which needs no files. Build a child theme when the changes must survive updates, when you edit templates, or when you add PHP.
What files does a child theme need?
A folder in wp-content/themes and a style.css file with a header naming the parent theme are enough to start. Add a functions.php file to load the parent styles, and copy in only the parent template files you plan to change.
What happens if the Template line is wrong?
WordPress cannot find the parent theme, so the child theme will not load the parent's design and may show an error or a broken site. Check that Template matches the parent folder name exactly, including lowercase letters.
Can I make a child theme for a block theme?
Yes. Edit the templates in the Site Editor, then use the Create Block Theme plugin to save those changes as a child theme. The plugin creates the files and activates the new theme for you.
Will my child theme break when the parent theme updates?
No, as long as the child holds only your changes. WordPress keeps loading the parent for everything else, so parent updates apply as normal. Review any template files you copied if the parent changes them.
Sources
- Child Themes - Theme Handbook Developer.WordPress.org
- Child themes Learn WordPress
- Including assets Learn WordPress
- wp scaffold child-theme - WP-CLI Command Developer.WordPress.org
- Create Block Theme Make WordPress Themes
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


