A WordPress child theme lets you customize an existing theme while keeping your changes separate from the parent theme’s files. That makes it easier to update the parent later without overwriting your custom code. This guide walks through the basic setup, explains what the key files do, and notes when a block theme needs a different approach.
Before you start
Make a backup and test the child theme on a staging site first. You need access to your site files through your host’s file manager, SFTP, or a local development setup. Identify the parent theme’s folder name inside wp-content/themes; the folder name is not always the same as the theme’s display name.
1. Create a child theme folder
Inside wp-content/themes, create a new folder for the child theme. Use a short, lowercase name with hyphens, such as my-site-child. Avoid spaces so the folder is easy to reference.
2. Add the required style.css header
Create style.css in the child theme folder. Add a theme header and set Template to the exact parent folder name. For example, if the parent folder is twentytwentyfour:
/* Theme Name: My Site Child Template: twentytwentyfour */
The Template value must match the parent theme directory exactly. If it is misspelled or points to the wrong folder, WordPress will not recognize the parent-child relationship. See the WordPress documentation for the required child-theme setup and stylesheet header.
3. Add functions.php only when needed
A child theme can include its own functions.php, but it is optional. WordPress loads the child theme’s file as well as the parent theme’s file; it does not replace the parent’s file. Add only your own functions, and do not copy the parent file wholesale because duplicated function names can cause errors.
For a classic theme, you may need to enqueue the parent stylesheet and then the child stylesheet. Check the parent theme’s documentation first because some themes already load styles or require a specific stylesheet handle. WordPress recommends using its enqueue functions rather than adding stylesheet links directly to a template. The official guide to including theme assets explains the relevant functions.
4. Add your customizations
Put custom CSS in the child theme’s style.css if that stylesheet is loaded by the parent theme setup. For small style changes, add one rule at a time and check the result on desktop and mobile. If you need to override a parent template, copy only the specific template into the matching path in the child theme, then keep it updated when the parent theme changes.
Block themes use the same parent-child relationship, but many visual settings and styles are managed through theme.json and template files rather than a traditional stylesheet. Follow the block theme’s documentation and test overrides carefully; a classic-theme CSS recipe may not apply as written.
5. Install and activate the child theme
- Keep the child theme folder in
wp-content/themes, or zip the folder if you plan to upload it. - In WordPress admin, open Appearance → Themes. If you made a ZIP, choose Add New Theme → Upload Theme and upload it.
- Preview the child theme, check key pages, menus, widgets, and custom settings, then activate it when the site looks correct.
- If styling or features are missing, switch back to the parent theme and review the folder name, stylesheet loading, and theme-specific setup instructions.
Common child-theme mistakes
- Using the theme’s display name instead of its exact folder name in
Template. - Editing the parent theme directly, which makes updates harder to maintain.
- Copying the parent
functions.phpinto the child theme and accidentally declaring functions twice. - Assuming a child theme automatically loads every stylesheet or works the same way for classic and block themes.
- Activating without testing a backup or staging copy first.
Frequently asked questions
Will parent theme updates delete my child-theme changes?
Changes stored in the child theme are kept separate from parent theme files, so updating the parent does not overwrite those child files. Still, test updates because parent markup, styles, or functions can change and affect your overrides.
Do I need a child theme for every CSS change?
Not always. A small CSS adjustment may fit in the site’s Additional CSS area, depending on your theme and workflow. A child theme is more suitable when you need reusable code, template overrides, or custom theme functions that must remain separate from parent updates.
Once your child theme is working, follow our guide to updating a WordPress theme safely to plan future updates and test changes before they reach visitors.
