WordPress Child Theme: How to Create One and When You Need It

Spread the love

A WordPress child theme is a small theme that borrows everything from a parent theme, so you can change the design without touching the original files. This guide shows how to create a child theme, what the functions.php file does, and how a block theme changes the picture, so you know when a child is worth the effort. If you are still choosing hosting and a theme, start with our guide on how to build a WordPress website, then come back here when you want to customise the look.

Quick answer: To build a WordPress child theme, make a new folder in wp-content/themes, add a style.css file whose header names the parent theme in a Template line, and activate it. Next, put your own CSS and PHP, including anything for the functions.php file, in the child, not in the parent. As a result, a parent theme update cannot erase your changes. For small tweaks, though, Additional CSS is often enough, and a block theme needs a child far less often.

What is a WordPress child theme and how does it work?

A WordPress child theme inherits the design and features of its parent. According to the WordPress Theme Handbook, child themes let you modify a theme without directly editing its code, so updates to the parent do not wipe out your work. The handbook adds that a child theme includes everything from its parent by default.

In practice, WordPress loads the child first and then fills the gaps from the parent. For example, if the child has its own header template, WordPress uses it. If it does not, WordPress falls back to the parent's file. Because of this, a child theme can be tiny: the handbook calls the style.css file the one file a child absolutely needs.

When you create a child theme, only two levels exist. The handbook says there is no standard way to build an installable grandchild theme, so you cannot stack a child on a child.

When do you need a WordPress child theme?

You need a WordPress child theme when you change theme files, such as templates or PHP functions, and you want those changes to survive updates. You do not need one for every tweak. The table compares the usual options.

What you wantSimplest optionChild theme needed?

|—|—|—|

Change a colour, font or spacingSite Editor Styles or Additional CSSNo
Add a few lines of CSSAdditional CSSNo
Edit a template file, such as a header or single post layoutChild themeYes
Add PHP, such as a custom function or a hookChild theme or a small pluginOften
Keep a design for years while the parent updatesChild themeYes

The WordPress documentation on Styles says that CSS you add there will not be overwritten by a theme update, but it is cleared when you switch themes. That fact matters. Additional CSS suits small visual changes, while a child suits code that belongs with the theme.

Also remember that an extensive WordPress child theme can become hard to manage. The handbook says a large rewrite may be better as a fork of the parent, and it leaves the choice to you, case by case.

How do you create a child theme step by step?

Follow these steps to create a child theme by hand, and keep the result small. The handbook's own example uses the Twenty Twenty-Four theme as the parent.

  1. Back up first. Take a copy of your database and files, as our WordPress backup guide explains.
  2. Make a folder. Inside wp-content/themes, create a folder with a short lowercase name, such as grand-sunrise.
  3. Add a style.css file. This is the one file a child theme cannot do without, according to the handbook.
  4. Write the header. At the top of style.css, add a comment block with two lines: Theme Name, which is any name you like, and Template, which is the parent's folder name.
  5. Match the folder name exactly. The Template value must be a 100% match of the parent's folder name inside wp-content/themes.
  6. Upload and activate. Zip the folder, then go to Appearance, then Themes, then Add New, upload it, and click Activate.

For example, a header for a child of Twenty Twenty-Four reads: Theme Name: Grand Sunrise, then Template: twentytwentyfour. Make sure the parent theme stays installed, because the child cannot run without it.

If something looks wrong after activation, check the Template spelling first. A typo there is an easy mistake to make, and WordPress cannot find a parent whose name does not match.

How do you load styles in a WordPress child theme?

Styles are where most beginners get stuck, because the answer depends on how the parent loads its own CSS. The handbook explains that you should enqueue stylesheets with the wp_enqueue_style function on the wp_enqueue_scripts hook. It describes three cases.

  • The parent loads its own and the child's style.css. Then the child has nothing to do.
  • The parent loads neither, or only its own. Enqueue the child's stylesheet with get_stylesheet_uri.
  • The parent loads only the active theme's stylesheet. You may also enqueue the parent's file with get_parent_theme_file_uri.

The handbook is honest that there are no hard rules here, so read the parent's code to see what it already enqueues. In short, test on a staging copy, then view the page source to confirm that each stylesheet loads once.

What can the functions.php file do in a child theme?

The functions.php file in a child theme holds your own PHP, such as new functions, hooks and filters. It does not replace the parent's file. According to the handbook, both files load, and the child's loads immediately before the parent's.

That order brings two rules:

  • Put custom code in the child. The handbook warns that if you add functions to the parent, the next theme update makes them disappear.
  • Never copy the parent's code into the child. Duplicate function names usually cause fatal errors.

Because PHP mistakes can take a site down, keep changes small. Moreover, a PHP error in this file can break the whole site, so use a staging site, or keep FTP access ready to rename the file. If you only need extra features, such as a contact form, a small plugin is often safer than theme code.

PHP and HTML template code on a dark screen, the kind of file a WordPress child theme overrides in the parent theme
PHP template code of the kind a child theme can override. Photo: Ilya Pavlov, CC0, via Wikimedia Commons, resized

How do you override templates in the parent theme?

To change a template, copy that file from the parent into the child folder, keeping the same name, and edit the copy. WordPress then uses your version. The handbook says the same idea works for template parts and patterns, although a pattern must also share the same registered slug.

You can also add new templates that the parent does not have. For files in your own folder, the handbook recommends get_theme_file_path to include PHP files from your functions.php file and get_theme_file_uri to link to images and scripts, because both look in the child first.

One caution applies. When the parent theme updates, your copy of a template does not update with it. Therefore, compare your override with the new parent file after each major update, in case the parent fixed a bug or changed the markup.

How does a block theme change the child theme approach?

A block theme builds the site with blocks, templates and a theme.json settings file, so you customise much of it in the Site Editor. In a block theme, Site Editor Styles cover many visual changes. The handbook says styles for these themes are generally handled through theme.json, which means enqueuing style.css is often unnecessary. It also says that the Template line in style.css is still needed for a child, and that the child's functions.php file is optional.

The handbook describes the layers on the front end in this order: WordPress defaults, the parent, the child, and then user customisations. Those user changes live in the database, not in files. As a result, many site owners never need a file-based child with a modern block theme.

Still, a child can help when you want to ship your design as code. The Create Block Theme plugin on WordPress.org can create a child theme of the active theme. Its developers warn that it is a development tool and that changes could alter your site or theme permanently, so only use it on a copy of your site first.

How do you update the parent theme safely?

Updating the parent theme is the point of a WordPress child theme, so make it routine. First, take a fresh backup. Next, update on a staging copy if your host offers one. Then check the pages that use your overrides, and look at the site on a phone.

If you use a block theme, also review your theme.json settings after an update. Use this short checklist before you press Update on the live site:

  • A recent backup exists and you know how to restore it.
  • The child theme is active and the parent is installed.
  • You have read the parent's changelog for template changes.
  • Your overridden templates still match the parent's markup.
  • You have tested forms, menus and the checkout, if you sell online.

Security matters here too. The Patchstack State of WordPress Security in 2026 report counted 91% of new vulnerabilities in plugins and 9% in themes, so pair updates with the steps in our WordPress security checklist. If a page slows down after a change, our WordPress speed optimization guide helps you find the cause.

What are the most common child theme mistakes?

Most WordPress child theme problems repeat. The table lists them with a quick fix.

MistakeWhat you seeFix

|—|—|—|

Wrong Template value"Parent theme missing" messageCopy the parent's exact folder name
Copying the parent's functions.php fileWhite screen or fatal errorDelete the copy, add only your own code
Loading the parent stylesheet twiceSlower pages, odd stylesCheck page source, enqueue once
Editing the parent directlyChanges vanish after an updateMove the edit to the child
Never checking overridesOld markup after a parent updateCompare files after each update

Need help with a WordPress child theme?

Develop Marketing helps businesses with social media, AI content, SEO, AEO and GEO, WordPress websites and advertising. If you would like a second pair of eyes on your theme setup, see our services page (in Thai) or contact us.

Frequently asked questions

Is a WordPress child theme still worth using in 2026?

Yes, for classic themes, and for any theme where you edit template files or add PHP. For a block theme, Site Editor Styles cover many changes without a file-based child, so check that option first.

Will a child theme slow down my site?

Not by itself, because a child usually adds very little. Slowness usually comes from loading the parent stylesheet twice, heavy plugins or large images, so check the page source and your images.

Can I switch from a parent theme to a child theme without losing settings?

Often you can, but settings stored by the theme, such as Customizer options, may not carry across. Take a backup, activate the child on a staging site, and compare the pages before you go live.

Do I need to know how to code to use a child theme?

You need to edit a text file and copy a folder to create a child theme, which suits most beginners. Writing PHP needs more care, so start with CSS and ask a developer for template changes.

Can I use a child theme with any WordPress theme?

Most themes support it, but the handbook says the exact steps depend on what the parent loads. Read the parent's documentation first, because it may describe its own child theme setup.

Final thoughts

A WordPress child theme is a safety net for your design work. To create a child theme, make a folder, add the style.css header with the right Template line, enqueue your styles once, and keep your code in the child. For small visual changes, try Additional CSS first, and for block themes, check Site Editor Styles before you write files. Whatever you choose, back up before you start and test each parent update on a staging copy. Those habits keep your customisations safe long after the first launch.

Related Posts

Sell on Etsy from Thailand: Setup, Payoneer and Fees

Spread the love

How to sell on Etsy from Thailand as of November 2026: shop setup, Etsy Payments with Payoneer, the layers of seller fees and Offsite Ads.

YouTube Demonetization: Reasons, Appeals and How to Recover

Spread the love

YouTube demonetization as of November 2026: the difference between video and channel level, how appeals work, and which policies cause most problems.

You Missed

Ao Luek to Phi Phi: Road, Pier and Ferry Times from Krabi

Ao Luek to Phi Phi: Road, Pier and Ferry Times from Krabi

Susan Hoi Shell Cemetery: Fees, Low Tide and the Fossil Slabs of Krabi

Susan Hoi Shell Cemetery: Fees, Low Tide and the Fossil Slabs of Krabi

Thailand Digital Nomad Tax: The 180-Day Rule and Foreign Income

Thailand Digital Nomad Tax: The 180-Day Rule and Foreign Income

Best Beaches in Hua Hin: Khao Takiab, Suan Son Pradipat and Sai Noi

Best Beaches in Hua Hin: Khao Takiab, Suan Son Pradipat and Sai Noi

Khao Mok Gai: Thai Chicken Biryani, Green Sauce and Halal Tips

Khao Mok Gai: Thai Chicken Biryani, Green Sauce and Halal Tips

Thailand in November: Weather, Festivals and Which Coast to Pick

Thailand in November: Weather, Festivals and Which Coast to Pick