If you’re customizing a distributed theme, start with a child theme. Edit the parent theme directly and a theme update erases every change. With a child theme, your changes live in a separate folder, so they survive updates.
All you need is one style.css (plus functions.php if you’re adding functions).
Step 1: create the folder
Inside wp-content/themes/, create a folder named the parent theme’s name plus -child.
wp-content/themes/
├── twentytwentyfive/ ← the parent theme (don't touch)
└── twentytwentyfive-child/ ← the child theme (build here)
├── style.css
└── functions.phpStep 2: write style.css
The comment at the top acts as a configuration file. Template: is the parent theme’s folder name.
/*
Theme Name: Twenty Twenty-Five Child
Template: twentytwentyfive
Version: 1.0.0
*/
/* your own CSS goes below */
.site-title {
letter-spacing: 0.08em;
}Theme Name—the name shown in the admin screen (up to you)Template—the parent theme’s folder name. This is the critical one
Step 3: load the parent’s CSS (functions.php)
The child theme’s style.css is loaded automatically, but the parent theme’s CSS sometimes isn’t. That’s the cause when your design breaks on activation.
<?php
function my_child_enqueue() {
wp_enqueue_style('parent-style', get_parent_theme_file_uri('style.css'));
}
add_action('wp_enqueue_scripts', 'my_child_enqueue');Note that recent themes (block themes) often have their own mechanism for loading the parent’s styles, so this code isn’t always necessary. Activate first, and add it if things break—that order is the reliable check.
Step 4: activate it
The child theme appears under “Appearance” → “Themes” in the admin screen. Activating it gives you the parent theme’s contents, with only your CSS and functions added on top.
If you want a thumbnail, put a 1200×900 PNG named screenshot.png directly in the child theme folder.
The rules for overriding templates
This is where child themes really earn their keep. “Override” and “add” differ depending on the file type.
| File | Behavior |
|---|---|
Templates like single.php and page.php | If the child has a file of the same name, the child’s is used (override) |
style.css | The child’s is loaded (load the parent’s yourself) |
functions.php | Not overridden. Both the parent’s and the child’s are loaded (the child’s first) |
templates/ and parts/ (block themes) | Matching names mean the child wins |
So when you want to tweak single.php, you copy it from the parent into the child and edit it there. There’s no need to write it from scratch.
twentytwentyfive-child/
├── style.css
├── functions.php
└── single.php ← copied from the parent, then editedThings to watch when writing functions.php
Because both the parent’s and the child’s are loaded, defining a function with the same name causes a collision and an error. Give your child theme’s function names a prefix.
<?php
// ✅ a prefix avoids collisions
function mychild_add_excerpt_support() {
add_post_type_support('page', 'excerpt');
}
add_action('init', 'mychild_add_excerpt_support');To replace a parent theme function: if the parent wraps it in if (!function_exists('…')), you can override it by defining a function with the same name in the child (the child’s functions.php loads first). For functions that aren’t wrapped, unhook them with remove_action() and add your own.
Child themes for block themes (FSE)
For themes that edit the whole site in the block editor, building a child theme works the same way. On top of that, these two are available.
theme.json—override color, spacing and typography settings in the childtemplates/andparts/—drop in an HTML file of the same name and the child wins
With block themes, simple visual tweaks often need nothing more than the site editor’s settings. A child theme becomes necessary when you need adjustments only code can make.
When you don’t need a child theme
- You’re using a theme you built yourself—you’re the only author, so editing directly is fine
- You’re only adding a little CSS—“Appearance” → “Customize” → Additional CSS is enough (and it survives theme updates)
Child themes are for when you’re customizing a distributed theme at the PHP level.
Theme developmentLet's build a theme for a company siteWant to build a theme from scratch? Head to the theme development courseSummary
- A child theme is the mechanism that keeps your customizations through parent theme updates
- The minimum is
Template: parent-folder-namein the header ofstyle.css. Addfunctions.phpto add functions - If things break, load the parent’s CSS with
wp_enqueue_style()(don’t use@import) - Templates are overridden; functions.php is added to. Prefix function names to avoid collisions
Setting up a child theme first is how you avoid ending up with “a site we can’t update.”