Sooner or later most WordPress projects need changes to the theme: a different header layout, an extra template, a few lines of CSS. If you edit the theme files directly, the next theme update overwrites your work. A child theme solves that problem. It lets you change what you need while the parent theme keeps receiving updates.
What a Child Theme Is
A child theme is a separate theme that depends on another theme, the parent. WordPress looks in the child theme first and falls back to the parent for every template the child does not include. That means a child theme can be tiny, often just a stylesheet and a functions file. Anything you put in the child theme overrides or extends the parent, and anything you leave out keeps working as before.
Child themes work with classic themes and block themes alike. With block themes, many design changes can be made in the Site Editor, but a child theme is still useful for code, custom templates and changes you want to keep under version control.
When You Need One, and When You Do Not
Use a child theme when you plan to change theme templates, add PHP functions tied to the design or write more than a small amount of custom CSS. It is also a good choice when several developers work on the same site, because the customisations sit in one clear place.
You may not need one if you only change colours, fonts or the logo through the Customizer or Site Editor, since those settings are stored in the database and survive theme updates. Small CSS tweaks can live in the Additional CSS panel. Functionality that has nothing to do with the design, such as custom post types or integrations, belongs in a plugin so it keeps working if you ever switch themes. Our page on WordPress plugins development covers that side.
Creating a Child Theme Step by Step
Create a new folder in wp-content/themes, for example parenttheme-child. Inside it, add a style.css file with a header comment. The two lines that matter most are Theme Name, which can be anything, and Template, which must match the parent theme’s folder name exactly.
Next, add a functions.php file. In classic themes you usually load the parent stylesheet from here with wp_enqueue_style(), hooked to wp_enqueue_scripts, followed by the child stylesheet. Check the parent theme’s documentation first, because some themes already load the child stylesheet for you and loading it twice adds a needless request. Unlike templates, the child theme’s functions.php does not replace the parent’s. Both files are loaded, the child’s first.
Then activate the child theme under Appearance, Themes. Menus and widget settings may need to be reassigned, so make the switch on a staging site or at a quiet moment.
Overriding Templates Safely
To change a template, copy the file from the parent theme to the same relative path in the child theme and edit the copy. WordPress will use the child version. Copy only the files you actually change. Every copied template is a file you now maintain, and when the parent theme improves or fixes that template, your copy will not get the change.
For smaller changes, look for hooks and filters before copying whole files. Many well-built themes offer actions in the header, footer and content areas, so you can add or remove output from functions.php without touching templates at all.
Common Mistakes to Avoid
- A Template line that does not match the parent folder name, which leaves the theme broken.
- Copying the entire parent theme into the child, which defeats the purpose.
- Putting site functionality in the child theme that should survive a theme change.
- Forgetting to keep the parent theme updated, since the child relies on it.
A child theme takes a few minutes to set up and saves a lot of rework later. Keep it lean, add a short comment explaining why each override exists and store it in version control with the rest of your custom code. If you are starting a new project, our guide to WordPress development setup helps you build a workflow where changes like these are easy to test.