21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

WordPress Child Themes: Why & How

Quick answer

A WordPress child theme is a small theme that inherits a parent theme and keeps your changes in a separate folder that updates never touch. Create wp-content/themes/parent-child, add a style.css whose Template line matches the parent folder exactly, enqueue the parent stylesheet from functions.php, then activate the child.

For WordPress users and developers who edit theme templates or code and need those changes to survive every theme update.

✓ In business since 2005
✓ INR + GST billing
✓ 24/7 Email Support — avg reply < 60 min
GuideWebJi®
knowledge
Read time
4 min
Sections
7
Updated
14 Nov 2026
Written by
WebJi® team

What is a WordPress child theme and why use one?

A child theme is a small theme that inherits all templates, styles and features from an installed parent theme and overrides only what you add, so parent theme updates never erase your customisations. WordPress replaces the parent's folder on every update; edits kept in the child's separate folder are left alone.

  • Update-safe: parent updates apply without losing your work.
  • Separated: your code stays apart from the vendor's code.
  • Minimal: you write only the files you actually change.

For a few colour or spacing tweaks, Additional CSS in the Customizer (classic themes) or Styles in the Site Editor (block themes) is enough. A child theme is for template edits, new functions and anything you would hate to lose.

Which files does a child theme need?

Strictly, only style.css with a header whose Template line names the parent's folder; classic themes usually add a functions.php that loads the parent stylesheet. Both go in a new folder under wp-content/themes, conventionally the parent's folder name plus -child.

/*
 Theme Name:   Astra Child
 Template:     astra
 Version:      1.0.0
 Text Domain:  astra-child
*/

The Template value must match the parent's folder name exactly — not its display name. Find it by listing wp-content/themes, or from the theme= value in the address bar when you open the theme's details under Appearance › Themes.

How do you load the parent stylesheet correctly?

In the child's functions.php, hook wp_enqueue_scripts, enqueue the parent's stylesheet with get_template_directory_uri(), then the child's with get_stylesheet_uri() listed as dependent on the parent.

<?php
add_action( 'wp_enqueue_scripts', 'astra_child_enqueue_styles' );
function astra_child_enqueue_styles() {
    wp_enqueue_style(
        'astra-parent-style',
        get_template_directory_uri() . '/style.css'
    );
    wp_enqueue_style(
        'astra-child-style',
        get_stylesheet_uri(),
        array( 'astra-parent-style' ),
        wp_get_theme()->get( 'Version' )
    );
}
  • Avoid @import in style.css; it forces stylesheets to load one after another and slows the page.
  • Check the parent first: some parents already load their CSS from other files, in which case you only enqueue the child stylesheet.
  • Never copy parent functions: both functions.php files run (the child's first), so a duplicated function name causes a fatal error.

How do you create and activate a child theme step by step?

Create the folder, add the two files, upload or save them, activate the child under Appearance › Themes, and confirm the site looks exactly as before.

  1. Find the parent's folder name, for example astra.
  2. Create wp-content/themes/astra-child through the file manager or SFTP.
  3. Add style.css with the header above and functions.php with the enqueue code.
  4. Go to Appearance › Themes and activate "Astra Child".
  5. Check that the site renders identically, then re-check menus and widgets, which classic themes may store per theme.

Try it on a staging site first: a typo in the Template line leaves a broken theme that is easy to fix away from the live site. With WP-CLI, wp scaffold child-theme astra-child --parent_theme=astra generates the files for you.

How do you override a parent template?

Copy the template file from the parent into the child at the same relative path — header.php, single.php, footer.php — and edit the copy; WordPress checks the child first, so the copy wins.

New templates, such as a custom landing-page layout or a template for a custom post type, also belong in the child. Change one file at a time and test in a private window; an incomplete copy can blank the page until restored. After major parent updates, compare your overrides with the new parent files, because fixes in the parent template do not flow into your copy. When something breaks, the WordPress 500 error guide shows how to find the failing file.

How do child themes work with block themes?

A child of a block theme still declares Template: in style.css, but its design changes usually go in its own theme.json and block templates rather than PHP files and enqueue code. The child's theme.json is merged over the parent's, and template files with the same name in the child's templates/ or parts/ folders take precedence.

Site Editor changes are stored in the database, not in theme files, so they survive parent updates even without a child theme. The Create Block Theme plugin can export those changes into a child theme. If a child keeps growing with dozens of overrides, maintaining your own theme may be cleaner.

Can you make a child theme without coding?

Yes: the free Child Theme Configurator plugin generates a child from Tools › Child Themes, and several theme vendors publish ready-made child themes or generators. Take a full backup first.

For changes that should survive switching themes altogether — a custom post type, a shortcode, tracking code — use a small plugin or a code-snippets plugin instead, because theme-attached code disappears when the theme changes. Teams without a developer often hand this layer to WebJi®'s WordPress web design service. The difference between theme and plugin responsibilities is set out in WordPress theme vs plugin.

FAQ

Frequently asked questions

Do I lose my Customizer settings when I activate a child theme?

On many classic themes, yes: Customizer settings, menu locations and widgets are stored per theme, so the child starts fresh. Child Theme Configurator can copy them across, or you can export and import them with a customizer export plugin.

Does a child theme slow down my site?

Not noticeably when built correctly. It adds one small stylesheet and a short functions.php. Using @import or duplicating large parent files is what adds weight.

Can a child theme have its own child?

No. WordPress supports one level only: a parent and a child. If you need deeper layering, build your customisations into a plugin or your own theme instead.

What happens if the parent theme is deleted?

The child stops working, because it depends on the parent's files. Keep the parent installed and updated, even though it is not the active theme.

Checked against the WordPress Theme Handbook, 15 November 2026 · Reviewed by the WebJi® team, Jaipur.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.