A child theme in WordPress is a theme that inherits the features and look of another theme, called the parent theme. Instead of editing the parent theme’s files directly, the developer creates a separate folder that contains only the desired customizations. This approach lets you update the original theme without losing your changes, preventing each new release from overwriting your work.
The practice is considered good practice in WordPress development, especially when working on third-party themes. The parent theme continues to provide the base structure, while the child theme overrides only the files or functions that need to change. This keeps compatibility with updates and reduces the risk of introducing errors into the original code.
How WordPress recognizes a child theme
WordPress determines which theme to display by reading the main stylesheet of the active theme. A child theme is recognized as such because its style file contains a header with a field that indicates the name of the parent theme’s folder. When the system loads a template, it first looks in the child’s folder and, if it doesn’t find it, moves to the parent’s.
This mechanism applies to template files like index.php, header.php or single.php, but not to the functions.php file. Functions defined in the child theme are loaded together with those of the parent, not instead of them. For this reason, when you want to replace an existing function, you often need to remove it before redefining it, or use the hooks provided by the parent theme.
When it’s worth creating one
Creating a child theme is recommended whenever you intend to modify a theme you didn’t originally author. If the theme is updated frequently, direct changes would be lost; the child theme protects your customizations instead. It’s also useful when working on multiple sites that share a common base and you want to apply specific variations for each.
What you can modify and where
A child theme can contain additional stylesheets, custom templates and its own functions. CSS changes are usually placed in a separate file, loaded after the parent’s, so they take precedence. Structural changes, such as the layout of elements on a page, require copying the relevant template file into the child’s folder.
When a child theme isn’t enough
A child theme isn’t suitable for every situation. If the changes affect the entire site structure, it might make more sense to develop a standalone theme. Also, a child theme always depends on the parent: if the parent is no longer updated or is abandoned, the child inherits its maintenance problems too.
The essential files and the optional ones
A child theme’s folder contains at least two files: a stylesheet with the header that declares the parent and a functions file. Other files are optional and are added only when needed. The minimal structure is designed to stay readable and easy to maintain over time.
| File | Required | Main function | Notes |
|---|---|---|---|
| style.css | Yes | Declares the parent theme and holds the styles | Must contain the header with the template field |
| functions.php | No | Adds custom functions and hooks | Loaded together with the parent’s |
| screenshot.png | No | Shows the preview in the dashboard | Optional, but useful for recognizing the theme |
| header.php | No | Replaces the header template | Copy only if you need to modify it |
| single.php | No | Replaces the single post template | Useful for changing the page structure |
Creating it step by step
- Locate the parent theme’s folder inside the themes directory of your WordPress installation.
- Create a new folder with a recognizable name, preferably without spaces or special characters.
- Create the style.css file inside it with the header that indicates the theme name and the parent template.
- Create the functions.php file if needed to add custom functions.
- Upload the folder to the server via an FTP client or the file manager of your hosting platform.
- Log in to the admin dashboard and activate the child theme from the appearance section.
- Check that the site displays correctly and that the customizations are active.
- Document the changes you made, so you can find them again for future maintenance.
Child theme, standalone theme or plugin: what to choose
There are alternatives to creating a child theme, such as using a standalone theme or a plugin for customizations. However, the child theme remains the most common solution when you want to modify the code without losing updates. The choice depends on the frequency of updates, the complexity of the changes and the technical skills available.
It’s important to remember that a child theme doesn’t replace good development practices. Customizations should still be tested in a staging environment before being applied to a production site, to avoid malfunctions visible to users.
Frequently asked questions
What exactly is a WordPress child theme?
It’s a theme that depends on another theme, called the parent, and inherits its features. It’s used to customize the parent without directly modifying its files.
Why should I use a child theme instead of modifying the original theme?
Because updates to the parent theme don’t erase your customizations. Modifying the parent directly means losing your changes with every new release.
What files must a child theme contain at minimum?
You need at least the stylesheet with the header that declares the parent and, in many cases, the functions file. The other files are optional.
Does the child’s functions.php file replace the parent’s?
No, the two files are loaded together. To replace a function, you need to explicitly remove it before redefining it.
Does a child theme slow down the site?
Generally the impact is negligible. Performance depends mainly on the theme’s code and the plugins used.
Can I create a child theme of a child theme?
It’s not recommended, because it complicates maintenance and the dependency chain. It’s better to work directly on the existing child.
From the glossary to the projectWant a fast, secure WordPress site built for Google?Custom WordPress site creation follows your business, with attention to performance, security and SEO.Discover WordPress site creation
Related entries:
WordPress SEO WordPress SEO for media files Clone WordPress site Web template
