This guide is for bloggers, agency owners and small-business site owners who want to change how a WordPress theme looks or behaves and are wondering whether they need a child theme. The short answer: sometimes. Below you will see when a child theme is worth the effort, how to build one for a classic theme and for a block theme, when to skip it, and which mistakes cause the most trouble.
Contents
What a child theme is and why people use one
According to the WordPress Theme Handbook, a child theme extends a parent theme so you can modify it without editing the parent’s files. The child inherits the parent’s design and functionality, and you write only the code that differs. The handbook lists these benefits:
- Your modifications are portable and can be replicated.
- Customizations stay separate from the parent theme.
- The parent can be updated without losing your changes.
- You save development time because you write only what you need.
The same handbook page gives a limit: only two levels exist, parent and child. Grandchild themes are not currently possible. It also warns that very heavy customization inside a child theme can become hard to manage, and that for large projects forking the original theme into a standalone parent may be the better call. That decision is made case by case.
Do you actually need one?
A child theme is for changes that live in theme files: PHP functions, template files, or a stylesheet you want under version control. It is usually unnecessary for light tweaks.
Enjoying this? Get our best tips by email
Practical SEO, link building and content strategies, straight to your inbox.
| Your goal | Likely best approach |
|---|---|
| A few CSS tweaks (button colour, spacing) | Additional CSS in the Customizer (classic themes) or the Site Editor’s style options (block themes). No child theme needed. |
| Visual changes on a block theme: colours, fonts, template edits | Edit in the Site Editor. These edits are stored in the database as user customizations. |
| Custom PHP functions or hooks | Child theme functions.php (or a small plugin if the code is not theme-specific). |
| Rewriting parent template files in a classic theme | Child theme with copies of those templates. |
| Changes so extensive that you override most of the parent | Consider forking the parent into your own standalone theme, as the handbook suggests. |
Where Additional CSS appears in the dashboard depends on your WordPress version and whether you use a classic or block theme, so look for it in your own admin area. One caution that applies either way: customizations stored in the database are separate from theme files, so decide deliberately where each change lives and keep a note of it.
Creating a classic child theme
The handbook describes the process in three parts: a folder, a style.css file, and installation.
Step 1: Create the folder
In wp-content/themes, create a folder named with the kebab-case version of your theme name. The handbook’s example theme, “Grand Sunrise”, becomes grand-sunrise.
Step 2: Add style.css with a Template header
style.css is the only strictly required file. It must start with a file header containing the standard required fields, plus a Template field that marks the theme as a child:
/**
* Theme Name: Grand Sunrise
* Template: twentytwentyfour
*/
The Template value must exactly match the parent theme’s folder name inside wp-content/themes, not its display name. For Twenty Twenty-Four the folder is twentytwentyfour.
Step 3: Install and activate
If the folder is not already on the server, zip it and upload it under Appearance > Themes > Add New, then activate it from Appearance > Themes. At first it will look identical to the parent because nothing is customized yet.
Step 4: Load styles in functions.php if needed
Whether you need this step depends on the parent. The handbook says to check the parent’s code, because there are no universal rules, and describes three cases:
- The parent already loads both its own stylesheet and the child’s: do nothing.
- The parent loads no stylesheet (the handbook cites Twenty Twenty-Four): enqueue the child’s stylesheet yourself.
- The parent loads only the active theme’s stylesheet: that picks up the child’s file automatically, but you may also want to enqueue the parent’s stylesheet explicitly.
The handbook’s pattern for enqueueing the child stylesheet looks like this (rename the function and handle to match your theme):
add_action( 'wp_enqueue_scripts', 'grand_sunrise_enqueue_styles' );
function grand_sunrise_enqueue_styles() {
wp_enqueue_style(
'grand-sunrise-style',
get_stylesheet_uri()
);
}
For the parent’s file, the handbook uses get_parent_theme_file_uri( 'style.css' ) in the same kind of function.
How functions.php and templates behave
- The child’s
functions.phpdoes not replace the parent’s. Both load, with the child’s loaded immediately before the parent’s. - Do not copy the parent’s
functions.phpinto the child. Duplicate function names cause fatal errors. - To override a parent template, template part or pattern, add a file with the same name in the child. Patterns must also share the same registered
Slug. - Use
get_theme_file_path()for PHP includes andget_theme_file_uri()for URLs so paths resolve from the child. - If you translate the child, give it a unique text domain and use
load_child_theme_textdomain()when loading translations manually.
Child themes for block themes
Block themes work a little differently. The handbook says loading style.css is often unnecessary for block themes, since they handle styling mainly through theme.json, which the theme handbook describes as the file used for configuring colours, default typography and front-end styles. A block child theme can still add or override templates, template parts and patterns by using matching file names.
The handbook also describes how the layers stack on the front end: WordPress’s default theme.json, then the parent theme, then the child theme, then user customizations. Those user customizations behave like a grandchild layer, except they are stored in the database rather than in files. This matters in practice: if you have already changed styles in the Site Editor, those changes sit on top of whatever the child theme defines.
Using the Create Block Theme plugin
You can write the files by hand, or use the Create Block Theme plugin from WordPress.org. Per its plugin page, it can create a blank theme, clone the active theme with your changes, create a child theme of the active parent, create a style variation, export a theme as a zip, and save user-changed templates and styles to the active theme. After you install and activate it, a panel opens from an icon beside the Save button in the Editor. Choose the “Create Child Theme” option there.
Check these points before you use it:
- The plugin page lists WordPress 6.8 or higher and PHP 7.4 or higher as requirements.
- Its disclaimer says changes made through the plugin could change your site or theme permanently, so make sure you know what you are doing before you press Save.
- Because the plugin writes theme files and can switch your theme, run it on a staging copy first rather than on the live site.
Test on staging first
Activating a child theme switches the live theme, so do it on a copy of the site. Our walkthrough on using a WordPress staging site before you update covers the setup. Our guide to automatic off-site WordPress backups explains how to keep a restore point in case something breaks. After activating on staging, check the home page, a post, an archive, search and the checkout or contact form if you have one, and confirm the front end still shows your custom styles.
Common mistakes
- Using the theme’s display name in Template. It must be the parent’s folder name.
- Copying the parent’s functions.php. Duplicate function names produce fatal errors. Only add your own code.
- Assuming styles load automatically. Check how the parent enqueues stylesheets before deciding whether you need an enqueue function.
- Editing the parent directly. Changes in parent files are lost on update, which is the problem child themes exist to solve.
- Forgetting database customizations. On block themes, Site Editor edits live in the database, so a child theme’s files may not behave as expected until you review them.
If you are still deciding which theme to start from, our piece on free and premium WordPress themes compares the options.
Key takeaways
- A child theme keeps your code and template changes separate from the parent so updates do not erase them.
- A classic child theme needs a folder and a
style.csswith aTemplateheader matching the parent’s folder name; addfunctions.phponly when you need code or stylesheet enqueueing. - Block themes rely on
theme.json, and Site Editor changes are stored in the database on top of parent and child. - Small CSS tweaks usually do not justify a child theme.
- Test on staging and keep a backup before activating.
FAQ
Will updating the parent theme break my child theme?
The handbook says the parent can be updated without losing your changes. That said, overridden templates are copies, so review them after a major parent update to see whether the parent’s versions changed.
Can I create a child of a child theme?
No. The handbook states grandchild themes are not currently possible, and there is no standard method for an installable grandchild theme.
Do I need a child theme for a block theme?
Not for most visual changes. The Site Editor stores your customizations in the database. A child is useful if you want file-based changes you can move between sites or keep in version control.
Why do my child theme styles not appear?
Check how the parent loads stylesheets. If it loads none, the handbook says to enqueue the child’s stylesheet in functions.php. Also confirm the Template header matches the parent’s folder name.
