A WordPress child theme lets you customize a parent theme without editing the parent theme’s files directly. That separation makes it easier to keep custom changes when the parent theme is updated.
This guide uses the current WordPress approach and explains an important point that older child-theme tutorials often miss: the @import method is not the preferred way to load stylesheets. Depending on the parent theme, styles may be handled automatically, through functions.php, or through modern theme features such as theme.json.
What Is a WordPress Child Theme?
A child theme inherits the functionality and design of a parent theme while allowing you to add or override selected files and settings. Your customizations remain separate from the parent theme, so updating the parent does not require you to recreate every change.
When Should You Use a Child Theme?
- When you need persistent customizations to a classic theme.
- When you need to override selected templates or add custom theme functionality.
- When the parent theme is actively maintained and designed to support child themes.
- When keeping custom code separate from the parent theme will simplify maintenance.
A child theme is not automatically the best solution for every site. For block themes, many visual changes can be managed through the Site Editor and theme.json. For larger projects, a custom theme may be more appropriate.
What Files Does a Child Theme Need?
At minimum, WordPress needs a child-theme style.css containing the required theme header and a Template value that exactly matches the parent theme’s directory name. A functions.php file is optional and is added when you need custom PHP functionality or stylesheet loading.
Example style.css header
/*
Theme Name: My Child Theme
Template: parent-theme-folder
*/
The Template value must match the parent theme folder under wp-content/themes/. WordPress documents this as a required part of the child-theme stylesheet header.
How to Create a Child Theme
- Create a new folder inside
wp-content/themes/, using a clear, unique name. - Create a
style.cssfile in that folder. - Add the child-theme header, including the exact parent-theme folder name in
Template. - Upload the folder through your hosting file manager, FTP, or SFTP, or package it as a ZIP and install it from the WordPress admin area.
- Go to Appearance > Themes and activate the child theme.
How to Load the Child Theme Stylesheet
Do not copy the old @import pattern from legacy tutorials without checking how the parent theme handles styles. WordPress recommends using the stylesheet enqueue system when a stylesheet needs to be loaded explicitly.
For a classic theme where the child stylesheet needs to be loaded, a simple approach is:
add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' );
function my_child_theme_enqueue_styles() {
wp_enqueue_style(
'my-child-theme-style',
get_stylesheet_uri()
);
}
The exact implementation depends on how the parent theme loads its own stylesheet. Check the parent theme before adding duplicate or conflicting styles.
Using functions.php Correctly
A child theme’s functions.php does not replace the parent’s file. Both are loaded. Add only the custom functions you need, and do not copy the entire parent functions.php into the child theme because duplicate function declarations can cause fatal errors.
How to Customize a Child Theme
- Use CSS for presentation changes where appropriate.
- Override templates only when the customization requires it.
- Add custom PHP through the child theme’s
functions.phpor separate included files. - For block themes, consider
theme.json, templates, patterns, and Site Editor capabilities before adding legacy overrides.
Common Mistakes to Avoid
- Using the wrong parent-theme folder name in the
Templateheader. - Following a legacy
@importstylesheet tutorial without checking the parent theme. - Copying the parent theme’s entire
functions.phpfile. - Making production changes without a backup or staging environment.
- Creating a child theme when the parent theme’s supported customization tools are sufficient.
Final Takeaway
A child theme remains a useful WordPress customization pattern, especially for classic themes that need code-level changes. The safest implementation is to keep custom code separate, use the required child-theme header, understand how the parent loads styles, and use WordPress’s current stylesheet and theme APIs instead of copying legacy snippets blindly.
Related: If you are setting up a new WordPress site, see our guide to installing and configuring WordPress.

