Worried that a theme update will wipe out your tweaks? A WordPress child theme keeps your changes in a separate folder, so the parent theme can update without overwriting them. Here is how to set one up safely.
New to site tweaks? Our guide to wordpress tips for beginners covers the wider basics.
| Item | Value |
|---|---|
| Required file | style.css |
| Required header field | Template header matching the parent theme’s folder name |
| Theme hierarchy | Two levels: parent and child |
| Functions file load order | Child functions.php loads right before the parent’s |
| Install location | wp-content/themes |
These figures come from the WordPress Theme Handbook page on child themes and the handbook’s theme functions page. They can change, so check the source before you rely on them.
What a WordPress child theme does
A child theme extends a parent theme. The handbook says it lets you modify an existing theme without directly editing that theme’s code, while still inheriting the parent’s design and functionality by default. Read the handbook explanation.
That matters on update day. A Learn WordPress lesson explains that parent themes receive periodic updates, and those updates overwrite any changes made directly in the parent. It calls using a child theme a best practice for that reason, as you can see in the lesson on enqueueing scripts and styles.
The Theme Handbook lists these benefits of a child theme:
- Your modifications are portable and replicable.
- Customizations stay separate from the parent theme.
- The parent can be updated without losing your changes.
- You only write the code you need.
If you are still deciding on a platform, read our comparison of wordpress vs wix first.
Should you use a child theme or a plugin?
The functions.php file behaves like a plugin, and the handbook notes that the same result can often be produced with either one. The deciding question is whether the feature belongs to the design or to the site. See the theme functions page for the full comparison.
The handbook’s rule of thumb is that themes should only deal with the site’s design. Features that should be available no matter what the website looks like are best placed in a plugin, according to the custom functionality page.
- Use a child theme for style changes, template overrides and small functions that only make sense with this design.
- Use a plugin for features that should be available no matter what the website looks like, so they keep working if you ever switch themes.
One practical reason: only code in the active theme’s functions.php is actually run, so features tucked into a theme disappear when that theme is swapped out.
How to create a child theme step by step
The Theme Handbook builds a child of the default Twenty Twenty-Four theme bundled with WordPress and names it “Grand Sunrise”. You can follow the same pattern for any parent theme you use.
- Create a folder in wp-content/themes using a kebab-case version of your theme name, such as grand-sunrise.
- Create style.css inside it. The handbook calls this the one absolutely necessary file for a child theme to exist.
- Add the file header with your Theme Name and a Template field. The Template value has to match the parent’s folder name exactly, so for Twenty Twenty-Four it is twentytwentyfour.
- Get the folder onto your site. The easiest route is to ZIP the theme and upload it through Appearance > Themes > Add New in your WordPress admin.
- Activate it. Once the theme is installed, open Appearance > Themes, locate it and click Activate.
Do not expect a visual change straight away. The handbook points out that the child looks identical to its parent until you customize it, and that is a sign the setup worked. Everything is documented on the child themes handbook page.

You need a working site before any of this, so follow our guide on how to install wordpress if you are starting from scratch.
Loading your styles correctly
The child theme’s stylesheet does not always load by itself. The handbook says you have to examine the parent theme’s code to see which stylesheets it enqueues, and the answer differs for every theme.
- If the parent loads both stylesheets, the child needs to do nothing.
- If the parent loads no stylesheet at all, as with Twenty Twenty-Four, you load your style.css from functions.php.
- If the parent loads only the active theme’s stylesheet through get_stylesheet_uri(), it loads the child’s file, and you may also want to enqueue the parent’s.
Use wp_enqueue_style() on the wp_enqueue_scripts hook rather than pasting link tags into templates. The Including Assets page says you should never manually hard code those HTML elements, because the hooks keep WordPress, plugins and your theme working together.
Block themes are simpler. The handbook says this step is often not needed for them, because their style handling is generally done through theme.json, as described on the child themes page.
Test after every change. In the Learn WordPress lesson, disabling the parent stylesheet’s enqueue makes the site look all wrong, with incorrect image sizes, font sizes and text alignment, so a broken layout usually points to a missing stylesheet. The lesson walks through that experiment.
Adding code safely with functions.php
A child theme can have its own functions.php file. The handbook describes adding a function there as a risk-free way to modify a parent theme, because an update to the parent will not make your new function disappear. See the theme functions page.
Load order is worth knowing. WordPress loads the child’s functions.php right before the parent’s, but it does not override it, so the child file can add to the parent’s functions or replace them.
A few habits keep things stable:
- Prefix every function and class name with a unique identifier, such as your theme name or an abbreviation, to reduce the chance of a naming conflict.
- Skip the closing PHP tag at the end of the file. The custom functionality page calls leaving it out valid PHP and standard practice.
- Use the right path helper for assets. get_theme_file_uri() falls back to the parent theme when the child is active and the file does not exist, per the Including Assets page.
The closing-tag habit has a real payoff. Stray whitespace after that tag can cause the “white screen of death” in some environments, a blank page that is hard to diagnose.
When a child theme is the wrong tool
Child themes suit small to moderate changes. The handbook warns that extensive customizations inside one can eventually become a management headache, and it suggests forking the original theme into a full parent theme of your own for bigger projects. That is a case-by-case decision, covered on the child themes page.
Block themes add another layer. Changes made through the editor’s user customizations are stored in the database instead of the filesystem, so they sit outside your child theme’s files and will not travel with a copy of the folder.
Frequently asked questions
Do I need to know PHP to start a child theme?
Show answer
Not to get started. A working child theme needs only a style.css with the right header, and the Learn WordPress lesson even says that file can be empty. PHP enters the picture when you add functions or enqueue stylesheets.
Why does my new child theme look just like the parent?
Show answer
That is expected. Nothing has been customized yet, so the child simply inherits the parent’s appearance until you add your own styles or templates.
Can I build a theme on top of a child theme?
Show answer
The handbook describes no standard method for an installable grandchild theme. Its theme hierarchy stops at parent and child, so the usual route is to put all your changes in one child.
What should I check if the child theme will not link to its parent?
Show answer
Compare the Template field in style.css with the parent’s actual folder name inside wp-content/themes. Copy the name character for character, since the handbook requires an exact match.



