How to Create a WordPress Child Theme (Step-by-Step for Beginners)
If you’ve ever customized your WordPress theme directly and then watched all your changes disappear after an update — you’re not alone. That frustration is exactly why every developer should know how to create a WordPress child theme before touching a single line of theme code.
In this guide, I’ll walk you through the entire process from scratch, even if you’ve never written a line of PHP before.
What Is a WordPress Child Theme?
A WordPress child theme is a theme that inherits all the functionality, styling, and templates of another theme (called the parent theme) — while allowing you to safely make your own customizations on top.
When your parent theme updates, your child theme remains untouched. Your changes stay safe.
Think of it like this: the parent theme is the original blueprint, and the child theme is your personal copy where you’re free to make changes without affecting the original.
Why You Should Always Use a Child Theme
- Your customizations survive theme updates
- You can easily revert to the original design
- It keeps your code organized and separate
- It’s the professional way to customize WordPress themes
If you want to see what happens when things go wrong without proper setup, check out my post on the top 5 common mistakes beginners make in WordPress — editing the parent theme directly is one of the biggest ones.
Step 1: Create a New Folder for Your Child Theme
Go to your WordPress installation and navigate to:
/wp-content/themes/Create a new folder here. Name it something like your-parent-theme-child. For example, if your parent theme is Twenty Twenty-Four, name it twentytwentyfour-child.
You can do this via FTP (FileZilla), your hosting file manager, or directly using LocalWP on your local machine.
Step 2: Create the style.css File
Inside your child theme folder, create a file called style.css and add this at the very top:
/*
Theme Name: Twenty Twenty-Four Child
Template: twentytwentyfour
Description: Child theme for Twenty Twenty-Four
Author: Your Name
Version: 1.0
*/The most important line here is Template: — it must exactly match the folder name of the parent theme. If this is wrong, your child theme won’t work.
Step 3: Create the functions.php File
Now create a functions.php file in your child theme folder and add this code:
<?php
function my_child_theme_enqueue_styles() {
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')
);
}
add_action('wp_enqueue_scripts', 'my_child_theme_enqueue_styles');This code loads the parent theme’s stylesheet first, then loads your child theme’s stylesheet on top. This is how WordPress knows which styles to apply.
This same functions.php file is where you can also add custom WordPress widgets later on, keeping everything neatly in one place.
Step 4: Activate Your Child Theme
Go to your WordPress dashboard → Appearance → Themes. You should now see your child theme listed. Click Activate.
Your site will look exactly the same as before — because the child theme is inheriting everything from the parent. The difference is that now any changes you make go into the child theme, not the parent.
Step 5: Start Customizing
Now you can safely:
- Add custom CSS to
style.css - Override parent theme template files by copying them into your child theme folder
- Add custom PHP functions to
functions.php
For example, to change your heading color sitewide, just add this to your child theme’s style.css:
h1, h2, h3 {
color: #2c3e50;
}How to Override a Parent Theme Template
If you want to modify a specific page template (like header.php or single.php), simply copy that file from the parent theme into your child theme folder with the same name. WordPress will automatically use your child theme’s version instead of the parent’s.
This is the safest way to make structural changes to your theme layout.
Quick Tip: Use a Plugin If You’re Not Comfortable with Code
If creating files manually feels intimidating, you can use a free plugin like Child Theme Configurator or Child Theme Wizard. These create the child theme for you in just a few clicks.
That said, I always recommend doing it manually at least once — it helps you understand exactly what’s happening under the hood.
What’s Next?
Once your child theme is set up, you should also think about keeping your site secure. Read my guide on essential WordPress security practices to make sure your customized site stays protected.
Creating a child theme is one of those habits that separates beginners from professional WordPress developers. It takes five minutes to set up and can save you hours of frustration down the road.