What Is a WordPress Child Theme and When Should You Use One?

If you have ever edited your WordPress theme’s files directly, you may have discovered a painful truth: when the theme updates, your changes disappear. A child theme solves this problem. It lets you customise a theme’s design and functionality while keeping the original theme, called the parent theme, intact and updatable.

This guide explains what a child theme is, when you need one, how to create it and alternatives for simple customisations.

At a Glance: A child theme inherits everything from a parent theme and stores your custom code separately, so updates do not erase it. Use one when editing theme templates or functions.php. For simple CSS tweaks, the Customizer’s Additional CSS or Site Editor styles may be enough.

How Parent and Child Themes Work

— —
Parent theme Contains the full design, templates and features
Child theme Contains only your customisations, such as styles, templates and functions

WordPress loads the child theme first. If a file exists in the child theme, it is used; otherwise WordPress falls back to the parent theme’s file.

Why Use a Child Theme?

  • Safe updates: parent theme updates do not overwrite your changes
  • Organised customisations: all custom code lives in one place
  • Easy rollback: remove changes by deactivating the child theme
  • Learning: a safe way to experiment with theme development

When You Need a Child Theme

— —
Adding a few CSS rules Usually no (use Additional CSS)
Editing template files (header.php, single.php) Yes
Adding functions to functions.php Yes, or use a code snippets plugin

How to Create a Child Theme

Option 1: Use a plugin or theme generator

Some themes provide a ready-made child theme download, and plugins can generate child themes automatically. This is the easiest option for beginners.

Option 2: Create one manually

  • Create a new folder in wp-content/themes, for example “mytheme-child”
  • Create a style.css file with a header that includes the theme name and a “Template” line matching the parent theme’s folder name
  • Create a functions.php file that enqueues the parent and child stylesheets
  • Upload the folder and activate the child theme in Appearance → Themes

After activation, review your site because some customiser settings may need to be reconfigured.

Child Themes and Block Themes

Block themes rely on theme.json and templates edited in the Site Editor. Many customisations can be saved directly in the Site Editor without editing files. For deeper changes, you can still create a child block theme with its own theme.json and templates. Tools are available to export customisations as a child theme.

Adding Custom CSS Without a Child Theme

For small design changes, use Appearance → Customize → Additional CSS in classic themes or the Styles panel in block themes. These changes are stored in the database and survive theme updates.

Adding Custom Functions Safely

Instead of editing functions.php, a code snippets plugin can store small PHP snippets independently of your theme. This keeps functionality even if you switch themes later.

Best Practices

  • Always back up before creating or editing a child theme
  • Test changes on a staging site
  • Keep custom code well commented
  • Copy only the template files you need to modify
  • Review changes after parent theme updates in case templates changed

Common Mistakes

  • Editing parent theme files directly
  • Copying the entire parent theme into the child theme
  • Wrong “Template” name in style.css, causing errors
  • Forgetting to enqueue stylesheets correctly
  • Using a child theme for simple CSS that could live in Additional CSS

Real-World Example

A small business owner edited her theme’s footer template directly to add business registration details. After a theme update, the changes vanished. She created a child theme, copied only the footer template into it and re-added her changes. Future updates installed safely, and her customisations remained intact.

Frequently Asked Questions

Do I always need a child theme?

No. Only when editing theme files or adding custom code tied to the theme.

Will a child theme slow down my site?

A properly built child theme has minimal performance impact.

Can I switch back to the parent theme?

Yes, but child theme customisations will no longer apply.

Do premium themes provide child themes?

Many do, often as a separate download in the theme package.

What happens if the parent theme is deleted?

The child theme will not work because it depends on the parent.

Are child themes needed for page builders?

Not usually for content edits, but they can help for custom code.

Conclusion

A child theme protects your customisations from being lost during updates. Use one when you edit templates or add theme-specific code, and use Additional CSS or code snippet plugins for smaller changes. With a child theme, you can customise confidently while keeping your parent theme secure and up to date.

Helpful Links

Scroll to Top