Sooner or later, every WordPress site owner hits the same wall: you want to change something small in your theme — a color, a template layout, a line of PHP — and you realize that editing the theme’s files directly means losing all of it the next time the theme updates. A WordPress child theme is the official, update-safe way to make those changes. In this guide, you’ll build one from scratch in about ten minutes, with just two files and no plugin required.
What Is a WordPress Child Theme?
A child theme is a theme that inherits everything — templates, styles, and functions — from another theme, called the parent theme. You only add the files you want to change. When WordPress loads a template, it checks your child theme first; if the file isn’t there, it falls back to the parent.
Think of it as a transparent layer on top of the parent theme. When the parent updates, WordPress replaces the parent’s folder wholesale — but your child theme folder is never touched, so every customization survives.
Why Not Just Edit the Parent Theme Directly?
Three reasons this keeps backfiring on people:
1. Updates wipe your changes. A theme update replaces the entire theme folder. Any file you edited goes back to the released version. There is no merge, no warning, no undo.
2. The Customizer’s “Additional CSS” box is limited. It survives updates, which is great for pure CSS tweaks — but it can’t change a template file, add a PHP function, or override theme.json settings.
3. A child theme is the sanctioned workflow. It’s what the WordPress Theme Handbook documents, what theme shops expect, and what any developer you hire will assume you’re using. If you’re serious about customizing, this is the baseline.
What You’ll Need
- Access to your theme files: SFTP/FTP, your host’s File Manager, or a staging site. (Test on a staging copy first — here’s how to move a site safely if you don’t have one.)
- The parent theme’s exact folder name, e.g.
twentytwentyfive. Check it inwp-content/themes/. - A backup. Always. If you don’t have a routine yet, follow this WordPress backup guide before touching anything.
Step 1: Create the Child Theme Folder
In wp-content/themes/, create a new folder for the child theme. Name it lowercase with no spaces — the convention is the parent’s folder name plus -child:
wp-content/themes/ ├── twentytwentyfive/ (parent — do not touch) └── twentytwentyfive-child/ (your new child theme)
Step 2: Add style.css
Every theme needs a style.css with a header comment. This header is how WordPress recognizes your theme and — critically — links it to its parent via the Template: line, which must match the parent folder name exactly, case-sensitive. Create style.css inside your new folder:
/* Theme Name: Twenty Twenty-Five Child Theme URI: https://example.com/twenty-twenty-five-child/ Description: Child theme for 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: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: twentytwentyfive-child */
Below the header, add only your CSS overrides. Don’t copy the parent’s entire stylesheet — the whole point is that the child stays tiny. For example:
/* Make all buttons slightly rounder */
.wp-block-button__link {
border-radius: 10px;
}
Step 3: Add functions.php (Enqueue the Styles)
Here’s where most DIY child themes break. Your child theme must load the parent’s stylesheet properly — and that means wp_enqueue_style(), never @import in CSS. @import forces the browser to download stylesheets one after another instead of in parallel, which measurably slows rendering.
Create functions.php in the child folder with this (adapted from the official Theme Handbook):
<?php
add_action( 'wp_enqueue_scripts', 'my_child_theme_enqueue_styles' );
function my_child_theme_enqueue_styles() {
$parenthandle = 'parent-style';
$theme = wp_get_theme();
wp_enqueue_style(
$parenthandle,
get_template_directory_uri() . '/style.css',
array(),
$theme->parent()->get( 'Version' )
);
wp_enqueue_style(
'child-style',
get_stylesheet_uri(),
array( $parenthandle ),
$theme->get( 'Version' )
);
}
Two functions to remember: get_template_directory_uri() points at the parent theme, while get_stylesheet_uri() points at the child theme’s style.css. Declaring the parent handle as a dependency (array( $parenthandle )) guarantees your styles load after the parent’s, so your overrides win without !important hacks.
Step 4: Activate and Test
Go to Appearance → Themes in wp-admin. Your child theme should appear as a separate tile. Activate it — your site should look exactly the same as before, because it inherited everything from the parent.
If the site looks broken or unstyled after activating, check two things first: the Template: header spelling (case-sensitive), and that your enqueue function is hooked to wp_enqueue_scripts. Nine times out of ten, it’s one of those.
Step 5: Override Templates and Functions
Now the fun part. To change any template, copy it from the parent into your child theme keeping the same relative path, then edit your copy. WordPress will always prefer the child’s version:
twentytwentyfive-child/
├── style.css
├── functions.php
└── template-parts/
└── post-meta.php ← your edited copy wins
For PHP behavior, one ordering fact matters: the child’s functions.php loads before the parent’s. That means:
- To replace a hooked parent function, use
remove_action()/remove_filter()(with the exact priority the parent used), then hook your own. - To extend behavior, just hook your own function at a later priority.
- If the parent wrapped a function in
if ( ! function_exists( ... ) )— a “pluggable” function — you can simply define your own version in the child, since yours loads first.
Child Themes and Block Themes (theme.json)
If your parent is a block theme (Twenty Twenty-Four, Twenty Twenty-Five, or any full-site-editing theme), much of its styling lives in theme.json — colors, palettes, spacing, typography presets. One behavior catches people out: a child theme.json replaces the parent’s theme.json entirely; settings don’t merge. So copy the parent’s theme.json into your child first, then change only what you need — a brand palette, a wider content size, custom button styles.
Prefer a no-code route? The official Create Block Theme plugin can export a child theme straight from the Site Editor with your style customizations baked in — handy for handing a finished design to a client as an installable theme.
6 Child Theme Mistakes to Avoid
1. Misspelling the Template header. Template: TwentyTwentyFive won’t match a folder named twentytwentyfive. Case and exact spelling matter — get this wrong and the child theme silently fails or doesn’t appear.
2. Using @import to load parent styles. Serial stylesheet loading is a real performance hit. Always enqueue (Step 3).
3. Copying the entire parent theme into the child. That defeats the purpose: you now have to maintain a full theme fork. Copy only the files you actually change.
4. Editing the parent “just this once.” That’s the update-wipe trap all over again. If a fix belongs in the parent, contribute it upstream; your site’s version lives in the child.
5. Trying to build grandchild themes. WordPress doesn’t support themes inheriting from child themes. One level of inheritance only.
6. Forgetting the child loads first. Writing remove_action() calls with the wrong priority, or assuming parent functions exist when your code runs, causes the classic “it works in the parent, breaks in the child” bug.
Do You Even Need a Child Theme?
Be honest about the job. If all you want is a few color tweaks, the Customizer’s Additional CSS is genuinely enough — a child theme adds moving parts you don’t need. But the moment you touch template files, PHP, or theme.json, the child theme is the right tool. And if you’re building fully bespoke designs for clients, that’s the point where a properly maintained custom theme — kept updated like any other software — earns its keep.
Wrapping Up
A WordPress child theme is two files, ten minutes, and the difference between customizations that survive updates and ones that don’t. Create the folder, write the header, enqueue the styles, and never edit a parent theme again.
If you’d rather not touch theme files yourself, I build and customize WordPress themes for clients — from child-theme tweaks to full custom builds. Get in touch and let’s talk about your site.