Knowledge base — Definition

Child Theme

How a WordPress child theme inherits from a parent theme, which files it needs, how overrides work, and when you are better off without one.

What Is a Child Theme?

A child theme is a WordPress theme that declares another installed theme as its parent, inherits all of that parent's templates, styles and functionality, and lets you change only the parts you need in a separate folder. When the parent theme is updated, its files are replaced, but the child theme's folder is left alone, so your changes survive.

The relationship is set by a single line in the child theme's style.css header: Template: parent-folder-name, which must match the parent's directory name in wp-content/themes/. WordPress then looks in the child theme first for any file it needs and falls back to the parent when the child does not provide one. Only one level of inheritance is supported; there are no "grandchild" themes. If you are new to how themes are structured, our entry on WordPress themes covers the basics.

Why a Child Theme Matters

A child theme is the supported way to customize a theme you did not write and still keep receiving its updates.

  • Updates stay safe: Edits made directly to a parent theme's files are erased the next time that theme updates. A child theme keeps them in a separate place.
  • Security patches still arrive: Because you never fork the parent, you can apply its bug and security fixes without merging code by hand.
  • Changes are easy to find: Everything custom lives in one small folder, which makes audits, handovers and troubleshooting much faster.
  • Version control is cleaner: You can keep the child theme in Git and treat the parent as a third-party dependency.
  • Rollback is simple: Switching back to the parent theme shows you instantly whether a problem comes from your customizations or from the theme itself.

How a Child Theme Works

  1. style.css header: The only required file. Its comment header needs a Theme Name and the Template line pointing at the parent. Custom CSS can go below the header.
  2. functions.php: Optional, and it does not replace the parent's file. The child's functions.php loads first, then the parent's, so you add hooks, filters and helper functions alongside the parent's code. This is also where you enqueue stylesheets with wp_enqueue_style() rather than using CSS @import.
  3. Template overrides: Copy a template such as single.php, header.php or a WooCommerce template into the child theme at the same relative path and edit the copy. WordPress uses the child's version instead of the parent's.
  4. Path functions: get_stylesheet_directory() points to the child theme and get_template_directory() points to the parent. Mixing them up is a common source of missing assets.
  5. Block themes and theme.json: For block themes, a child can include its own theme.json, which is merged with the parent's, so you can change a palette, font sizes or spacing scale without copying everything. HTML templates in templates/ and template parts in parts/ override the parent's files of the same name.

Common Child Theme Mistakes

  • Editing the parent anyway: Creating a child theme but still patching the parent's files, which are then lost on the next update.
  • Copying too many templates: Overriding whole templates to change one line. Overridden templates stop receiving the parent's fixes, so they quietly go out of date.
  • Wrong Template value: Using the parent's display name instead of its folder name, which leaves the child theme flagged as broken.
  • Putting site features in the theme: Custom post types, shortcodes and integrations placed in a child theme disappear when the design changes. Those belong in a plugin.
  • Assuming Site Editor changes live in the child: Edits made in the Site Editor are saved to the database, not to theme files, until you export them.

Best Practices for Child Themes

  • Prefer hooks over overrides: If the parent offers an action or filter for what you need, use it in functions.php rather than copying a template.
  • Keep a list of overridden templates: Note which parent version each override came from, and compare them when the parent releases a major update.
  • Separate presentation from functionality: Keep the child theme for design and layout; move business logic into a small site-specific plugin.
  • Test parent updates on staging: Update the parent on a staging copy first, check overridden templates, then deploy. This fits naturally into a maintenance routine.
  • Export block theme edits: For block themes, use a tool such as the Create Block Theme plugin to write Site Editor changes back into the child theme's files so they are versioned.

When You Do Not Need a Child Theme

If you wrote the theme yourself, or a studio built a custom theme for you, there is no parent to protect, so a child theme adds nothing. If all you change is CSS and settings in the Customizer or Site Editor, those are stored in the database and already survive updates. And if the change is functional rather than visual, a plugin is usually the better home.

Child Themes at PerfectPixels

When a client's site runs on a commercial or framework theme, we set up a child theme from day one, keep it in version control, and limit template overrides to what is genuinely needed. When we build a custom theme through our WordPress development work, we skip the child theme and put site functionality into a dedicated plugin instead, so the design can change later without losing features.

Frequently Asked Questions

Do I need a child theme to add custom CSS?

Not necessarily. CSS added in the Customizer's Additional CSS panel or in the Site Editor's styles is stored in the database and survives theme updates. A child theme becomes worthwhile once you are editing templates, adding PHP or managing a large stylesheet in version control.

Will a child theme slow my site down?

Not in any meaningful way when it is set up correctly. Enqueuing the stylesheets properly instead of using @import avoids an extra blocking request. Heavy template overrides or extra scripts are what affect speed, not the child theme itself.

Can I switch to a different parent theme later?

Not directly. A child theme is tied to the templates, hooks and class names of one specific parent, so changing parents usually means rebuilding the child. This is another reason to keep functionality in a plugin, where it is independent of the theme.

Further reading: Child themes — WordPress Developer Resources.

All terms

Need help putting this into practice?

Talk to the studio.

↯ Quick contact

Just a quick question?

Ask anything — we reply within two business days.