How to Create a WordPress Child Theme (Step-by-Step)
Learn how to create a WordPress child theme from scratch—safely customize any theme without losing changes on updates. Includes code snippets and clear steps.
If you’ve ever customized a WordPress theme directly and then watched those changes vanish after an update, you already know why child themes exist. A child theme inherits all the styles and functionality of its parent, but keeps your customizations in a separate layer that survives every update the parent theme goes through.
Creating a child theme sounds technical, but the minimum viable version requires just two files and about ten minutes. This guide covers the complete process—from creating the folder to overriding templates—along with notes on when a plugin might be a better fit than a hand-built child theme.
What Is a Child Theme and Why Use One?
A child theme is a theme that references a “parent” theme as its source of truth. WordPress loads the parent theme’s files by default, then substitutes any matching file it finds in the child theme directory.
This means:
- Your CSS tweaks and custom PHP files live in the child theme
- The parent theme updates normally without overwriting your work
- You can safely undo your customizations by deactivating the child theme
The WordPress developer documentation covers this in full, but the practical walkthrough below is all you need to get started.
Before You Begin
- Make sure you know which parent theme you want to extend. The parent theme must be installed on your site.
- Have FTP access (FileZilla is free and works well) or access to your host’s file manager.
- Consider backing up your site before making file-system changes—it takes only a few minutes and protects against mistakes.
Step 1: Create the Child Theme Folder
Connect to your server via FTP and navigate to:
/wp-content/themes/
Create a new folder for your child theme. The naming convention is parent-theme-name-child. For example, if you’re extending Twenty Twenty-Five, name the folder:
twentytwentyfive-child
Step 2: Create style.css
Inside your new child theme folder, create a file named style.css. This file must contain a specific header comment block that tells WordPress about the theme and, critically, which parent to use:
/*
Theme Name: Twenty Twenty-Five Child
Theme URI: https://example.com/
Description: A child theme of Twenty Twenty-Five
Author: Your Name
Author URI: https://example.com/
Template: twentytwentyfive
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentytwentyfive-child
*/
The Template field is critical. It must exactly match the folder name of the parent theme (not the display name). If you get this wrong, WordPress will display an error when you try to activate the child theme.
Any CSS you add below the header comment will override the parent theme’s styles:
/* Example: change body font size */
body {
font-size: 18px;
}
Step 3: Create functions.php
The style.css header is enough to make a valid child theme, but without loading the parent’s stylesheet, your site will lose all styling. Create a functions.php file in the same child theme folder:
<?php
function my_child_theme_enqueue_styles() {
$parent_style = 'parent-style';
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 ),
wp_get_theme()->get( 'Version' )
);
}
add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' );
This enqueues the parent theme’s stylesheet first, then loads the child theme’s stylesheet on top of it—ensuring your overrides take effect.
Note for block (FSE) themes: Full Site Editing block themes like Twenty Twenty-Three and Twenty Twenty-Five handle styles differently. For block themes, the
style.cssheader and thetheme.jsonfile in your child theme directory are the main customization entry points; you often don’t need thewp_enqueue_styleapproach above. Check the developer docs for the block theme-specific approach.

Step 4: Activate the Child Theme
- Log in to your WordPress dashboard.
- Go to Appearance → Themes.
- You should see your child theme listed. If you don’t, double-check that the
Templatevalue instyle.cssmatches the parent theme’s folder name exactly. - Click Activate.
Your site should look identical to before—the child theme is loading everything from the parent. Now any changes you make to style.css or functions.php in the child theme directory will take effect.
Step 5: Overriding Parent Theme Templates
The real power of child themes is template overriding. If you want to change how a specific page type is displayed—for example, the single post template—copy the relevant PHP file from the parent theme into your child theme folder, keeping the same directory structure.
For example, to override the single post template:
- Find
single.phpin the parent theme’s folder (e.g.,/wp-content/themes/twentytwentyfive/single.php) - Copy it to
/wp-content/themes/twentytwentyfive-child/single.php - Edit the copy in the child theme directory
WordPress uses the template hierarchy to determine which file to load. When it finds a matching file in the child theme, it uses that version instead of the parent’s.
You can override any template file this way: page.php, archive.php, header.php, footer.php, and so on.
Overriding Parent Functions
You can also override specific PHP functions from the parent theme in your child theme’s functions.php. However, this only works if the parent theme’s function is wrapped in function_exists():
// Parent theme (example):
if ( ! function_exists( 'mytheme_custom_header' ) ) {
function mytheme_custom_header() {
// Parent header code
}
}
// Child theme functions.php can now override it:
function mytheme_custom_header() {
// Your replacement code
}
Well-maintained themes use this pattern. If the parent doesn’t wrap its functions in function_exists(), you’ll get a fatal error if you try to redefine them—in that case, use hooks and filters instead of redefining functions outright.
Adding Custom CSS Without Touching Files
If your only goal is to add CSS tweaks, the Appearance → Additional CSS panel in the WordPress Customizer lets you add styles without creating a child theme at all. The WordPress.org documentation covers the Customizer in detail if you want to explore what it can do before committing to a child theme. The downside is that these styles are stored in the database and tied to the current theme—switching themes loses them.
For anything beyond minor CSS tweaks (template changes, custom functions, enqueueing additional scripts), a child theme is the proper approach.
Plugin Alternatives
If the file-creation process feels like too much overhead for a simple project, a few plugins can create a child theme for you:
- Child Theme Configurator (free on WordPress.org plugins directory) – Generates a child theme from your dashboard, including stylesheet parsing to help identify parent styles to override.
- WP Child Theme Generator – A simpler alternative that creates the folder and required files automatically.
These tools are useful shortcuts, but understanding what the two files actually contain is worth the five minutes—it makes troubleshooting far easier later.
Summary: Child Theme File Checklist
| File | Required | Purpose |
|---|---|---|
style.css | Yes | Theme declaration + CSS overrides |
functions.php | Recommended | Enqueue parent stylesheet + custom PHP |
| Template files | Optional | Override specific page layouts |
theme.json | Optional (block themes) | Override design tokens and settings |
Child themes are one of the foundational skills for working confidently with WordPress. Resources like WPBeginner and learn.wordpress.org offer additional tutorials if you want to reinforce any of the steps above. Once you have one set up, you can customize your theme freely without worrying about losing changes. When you’re looking for a parent theme to start from, our collection of free WordPress themes are built with clean, hookable code that makes child theme development straightforward.
For everything else about installing and activating themes, our guide on how to install a WordPress theme covers both the dashboard upload method and the FTP approach.