You customised your WordPress theme — changed fonts, adjusted colours, tweaked the layout — and then the theme updated and every single change disappeared. Or you are hesitant to customise at all because you know updates will wipe your work. A WordPress child theme solves this completely. How to create a child theme in WordPress is one of the most important skills any site owner or developer can learn, because it lets you modify a theme safely, permanently, and without fear of losing anything when the parent theme updates. We go deeper on the whole subject in our Complete Guide to WordPress How.
How to Create a Child Theme in WordPress — What You Need to Know First
Before writing any code, understanding what a WordPress child theme actually is saves a lot of confusion. A child theme is a separate WordPress theme that inherits all the styles, templates, and functionality of a parent theme. When the parent theme updates, the child theme’s customisations remain completely untouched — because your changes live in the child theme’s files, not in the parent theme’s files.
A child theme requires exactly two files to function: a style.css file that declares the parent-child relationship, and a functions.php file that enqueues (loads) the parent theme’s stylesheet. Everything else in a child theme is optional — you only create the files you need to override. If you want to change how the header looks, you copy the parent theme’s header.php into your child theme folder, modify it there, and WordPress automatically uses your version instead of the parent’s. The parent theme continues to serve all files you have not overridden.
WordPress child themes work with any properly-coded parent theme. The most common parent themes are GeneratePress, Astra, OceanWP, Twenty Twenty-Four, and Divi — all of which are built with child theme support in mind. Block-based themes (Full Site Editing themes) use a slightly different approach involving theme.json rather than style.css overrides, but the core concept is identical. This guide covers both the classic PHP-based child theme approach and the block theme variation. Once you understand the WordPress child theme structure, modifying any parent theme safely becomes straightforward., modifying any theme safely becomes straightforward.
Creating the Child Theme Folder and Files
The WordPress child theme lives in its own folder inside wp-content/themes/. The folder name can be anything, but convention is to name it after the parent theme with “-child” appended — so for Astra the folder would be astra-child. Access your site’s files via FTP (FileZilla, Cyberduck), your hosting control panel’s File Manager, or WP-CLI. Navigate to wp-content/themes/ and create a new folder named parenttheme-child.
Inside the child theme folder, create style.css with this content — replacing the values with your actual details:
/*
Theme Name: Astra Child
Theme URI: https://yoursite.com
Description: Child theme for Astra
Author: Your Name
Author URI: https://yoursite.com
Template: astra
Version: 1.0.0
Text Domain: astra-child
*/The critical line is Template: astra — this must exactly match the parent theme’s folder name (lowercase, as it appears in wp-content/themes/). An incorrect Template value causes WordPress to report the child theme as broken. Now create functions.php in the same child theme folder with this content to correctly load the parent theme’s styles:
<?php
add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_styles' );
function child_theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
?>With both files created, navigate to WordPress admin → Appearance → Themes — the WordPress child theme now appears in the list. Click Activate. Your site looks identical to before, but any customisations now go into the WordPress child theme and survive parent theme updates. Our guide on updating WordPress safely covers the full update process including verifying your child theme’s compatibility before applying parent theme updates.
Adding Custom CSS and Templates to Your Child Theme
With the WordPress child theme active, there are three main ways to customise. Understanding when to use each one helps you make WordPress child theme customisations correctly from the start, without creating maintenance headaches later.
Custom CSS via the child theme’s style.css: Add all your CSS rules directly to the child theme’s style.css after the header comment block. These rules load after the parent theme’s CSS and override any styles you specify. This is the right approach for visual changes — colours, fonts, spacing, hover effects. Example: to change the heading colour, add h1, h2, h3 { color: #2c3e50; } to style.css. The child theme’s style.css takes precedence over the parent’s for any selector you define.
Template file overrides: To change the structure of a specific page element — the header layout, footer structure, single post template, or sidebar — copy the relevant PHP file from the parent theme folder into your child theme folder. Maintain the same filename and relative path. WordPress automatically uses the child theme version of any file that exists in both places. For example, to modify the header: copy parenttheme/header.php to astra-child/header.php → edit the child theme copy. The parent theme’s header.php remains untouched and the child version handles all header rendering. When the parent theme updates, your child’s header.php is never overwritten.
functions.php additions: The WordPress child theme’s functions.php is loaded by WordPress in addition to (not instead of) the parent theme’s functions.php. Add custom functions, hooks, filters, shortcodes, and feature registrations here. Common additions include registering custom post types, adding widget areas, enqueuing additional scripts, and hooking into WooCommerce actions. Keeping your functional customisations in the child theme’s functions.php means they survive every parent theme update with zero maintenance required.
Using Plugins to Generate Child Themes Automatically
For those who prefer not to create files manually, several WordPress plugins generate a complete child theme with a single click. How to create a child theme in WordPress through a plugin is particularly useful for non-developers or when setting up child themes quickly across multiple sites.
The most popular WordPress child theme generators are Child Theme Configurator (free, highly configurable) and One-Click Child Theme (free, minimal). To generate a WordPress child theme with Child Theme Configurator: install and activate it → Tools → Child Theme Configurator → select the parent theme from the dropdown → choose which assets to include → Generate. The plugin creates the child theme folder, style.css, and functions.php automatically, then offers to activate it. It also analyses the parent theme’s CSS and pre-populates the child’s style.css with variables for quick colour and font changes.
The plugin approach is reliable for most themes but has a limitation: it generates a static snapshot of the parent theme’s CSS at the time of child theme creation. When the parent theme updates significantly, the pre-populated CSS variables in the child’s style.css may reference selectors that no longer exist in the parent. The manual approach (creating only style.css and functions.php, adding custom CSS as needed) avoids this by only overriding what you explicitly specify. For long-term maintainability, a minimal WordPress child theme requires less ongoing attention than the fully-generated approach. According to the WordPress developer handbook, the recommended child theme consists of only style.css with the parent declaration header and a functions.php that correctly enqueues styles — everything else is added only as needed.
Child Themes for Block Themes (Full Site Editing)
WordPress child theme creation for Full Site Editing themes works similarly — Block-based WordPress child themes follow the same folder structure. WordPress 5.9+ introduced block themes that use theme.json for styling rather than CSS and PHP templates. Creating a child theme in WordPress for a block theme follows the same folder and style.css structure, but the customisation approach is different.
For block themes like Twenty Twenty-Four or Blocksy, the child theme’s theme.json overrides the parent’s design settings — colours, typography, spacing, block styles — without writing CSS. Create your WordPress child theme folder and style.css as described above. Then create theme.json in the child theme folder. This file merges with the parent’s theme.json, with child values taking precedence. To change the primary colour: add the color palette entry in the child’s theme.json with the new value. WordPress merges both theme.json files and applies the child’s value wherever it differs from the parent’s.
Block theme child themes also support block template overrides. Copy any template file from parenttheme/templates/ (e.g., single.html) into your child theme’s templates/ folder and edit it in the Site Editor or directly in the file. WordPress uses the child version while the parent template remains intact. The Global Styles interface saves customisations to the WordPress child theme‘s database record rather than the parent’s, ensuring that colour, typography, and spacing changes made through the visual editor survive parent theme updates when a properly configured child theme is active. Our guide on optimising WordPress performance covers how child theme structure affects CSS loading performance, including the correct enqueue order for child and parent stylesheets that prevents FOUC (flash of unstyled content).
Testing and Troubleshooting Your Child Theme
After activating the WordPress child theme, verifying it is working correctly and diagnosing common activation issues takes only a few minutes and prevents problems from reaching live visitors.
Confirm the WordPress child theme is active: Appearance → Themes — the child theme shows “Active” and the parent theme shows “Parent Theme.” Check the front-end of the site looks identical to before activation. If the site looks broken or unstyled, the most common cause is an incorrect Template value in style.css — verify it matches the parent theme’s exact folder name. A second common cause is a syntax error in functions.php — enable WordPress debug mode (add define('WP_DEBUG', true); to wp-config.php) and reload the site to see any PHP errors.
Test a simple CSS change to confirm the inheritance is working: add a clearly visible rule to the child’s style.css such as body { border: 3px solid red; } → save → refresh the front-end. If the red border appears, the child theme’s CSS is loading and overriding the parent correctly. Remove the test rule after confirming. If the rule has no effect, the style.css enqueue in functions.php has an issue — verify the wp_enqueue_style call uses the correct parent stylesheet handle. The parent theme’s handle is usually “parent-style” by convention, but some themes use a custom handle — check the parent theme’s functions.php to find the exact handle name used in its own enqueue call and match it in your child theme’s functions.php.
For ongoing maintenance: when the parent theme releases an update, review the changelog before updating. If the update changes a template file that you have overridden in the child theme, you may need to manually merge the parent’s changes into your child’s version to benefit from bug fixes or new features in that template. This is the only ongoing maintenance a child theme requires — and it is far less work than losing all customisations to a blind update. Using a staging site to test parent theme updates before applying them to production gives full confidence that your WordPress child theme customisations remain intact through every update cycle.
When deciding whether to use a WordPress child theme or the built-in Customizer, the answer is almost always the child theme. The Customizer stores settings in the database — it does not protect template file changes and does not allow adding custom PHP functions. A child theme stores overrides in files that persist through theme updates, allow full PHP access, and can be version-controlled in Git. The only reason to skip a child theme is if you are using a theme builder like Elementor or Beaver Builder that stores all design changes in the database independently of the theme files — in that case, the builder’s own save mechanism provides update protection. For any manual code-based customisation, the WordPress child theme is the only safe approach.
Backing up your WordPress child theme folder is a simple but important step that is often overlooked. Since the child theme contains all your customisations, losing it through a server failure or accidental deletion would require rebuilding every change from scratch. Include the child theme folder in your regular WordPress backup routine — most backup plugins (UpdraftPlus, All-in-One WP Migration) include all theme files in their backups automatically. For development teams, committing the child theme folder to a Git repository provides version control, rollback capability, and collaboration support that complements the backup plugin’s disaster recovery role. A well-maintained WordPress child theme in version control is the professional standard for any site that expects ongoing development and long-term maintenance across multiple contributors. Related: WordPress Shortcodes Guide.







