WordPress Themes

How to Create a WordPress Child Theme

Create a child theme for a classic theme step by step: style.css header, functions.php, enqueueing the parent stylesheet correctly, overriding templates and activating it safely.

Folder tree of a WordPress child theme with style.css and functions.php layered on top of its parent theme

A WordPress child theme is a small theme that inherits everything from a parent theme and holds only your changes, so the parent can be updated without wiping your customizations. To create one, make a new folder in wp-content/themes/, add a style.css whose header names the parent in a Template: line, add a functions.php that loads the stylesheets, then activate it under Appearance > Themes.

This guide covers classic themes. If your parent is a block theme, the process is slightly different; see child themes for block themes.

Why use a child theme

  • Update safety. Edits made directly in a parent theme are overwritten on the next update.
  • A clear record of changes. Everything custom lives in a few files you can version-control.
  • Easy rollback. Switch back to the parent to see whether a problem comes from your code.

Not every change needs a child theme. Small CSS tweaks fit in Appearance > Customize > Additional CSS, and site features (custom post types, integrations) belong in a plugin. The parent vs child theme comparison explains where each change belongs.

Step 1: Create the folder

In wp-content/themes/, create a folder named after the parent plus -child, for example astra-child. Use lowercase and hyphens, no spaces.

You need the parent's folder name (not its display name). Find it in wp-content/themes/: for example twentytwentyone, astra or generatepress.

Step 2: Add style.css

/*
 Theme Name:   Astra Child
 Template:     astra
 Description:  Child theme for Astra
 Author:       Your Name
 Version:      1.0.0
 Text Domain:  astra-child
*/

/* Your custom CSS below */

Only Theme Name and Template are required. Template must match the parent's folder name exactly, including case. A wrong value gives the error "The parent theme is missing".

Step 3: Add functions.php and load the styles

Do not use @import in style.css; it delays rendering. Enqueue the stylesheets instead. How you do it depends on how the parent loads its own CSS.

If the parent loads its stylesheet with get_template_directory_uri()

Most themes do this. The parent's CSS is already loaded; you only need to load the child's, after it:

<?php
add_action( 'wp_enqueue_scripts', 'astra_child_enqueue_styles', 20 );

function astra_child_enqueue_styles() {
    wp_enqueue_style(
        'astra-child-style',
        get_stylesheet_uri(),                      // the child's style.css
        array(),                                   // add the parent handle here if you know it
        wp_get_theme()->get( 'Version' )
    );
}

If the parent loads style.css with get_stylesheet_uri()

Then, once the child is active, the parent will load the child's file instead of its own, so you must load the parent's explicitly:

<?php
add_action( 'wp_enqueue_scripts', 'my_child_enqueue_styles' );

function my_child_enqueue_styles() {
    $parent = 'parent-style';
    wp_enqueue_style( $parent, get_template_directory_uri() . '/style.css', array(), wp_get_theme()->parent()->get( 'Version' ) );
    wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( $parent ), wp_get_theme()->get( 'Version' ) );
}

Not sure which applies? Activate the child and view the page source. If the parent's CSS file is missing, use the second version. The version argument busts browser caches when you change the version number. More in enqueueing CSS and JavaScript.

A child's functions.php does not replace the parent's; both load, the child's first. So never copy the parent's whole functions.php into the child: you would declare every function twice and trigger a fatal error.

Step 4: Add a screenshot (optional)

Add a screenshot.png of 1200 × 900 pixels to the child folder so it is recognizable under Appearance > Themes.

Step 5: Activate it safely

  1. Note your current Customizer settings and menu locations. Some themes store options per theme (as theme mods), so they do not carry over automatically. Many popular themes offer an import/export or keep options shared.
  2. Go to Appearance > Themes, use Live Preview on the child to check the site, then Activate.
  3. Reassign menus and widgets if needed, and check a few key pages.

Step 6: Override a template file

To change a template, copy it from the parent into the same relative path in the child, then edit the copy. For example, copy parent/template-parts/content-single.php to child/template-parts/content-single.php. WordPress uses the child's file first.

Copy only what you need: every overridden file is one you must compare with the parent after major updates. Prefer hooks and filters where the parent offers them. See overriding parent templates and WordPress hooks.

Referencing files correctly

FunctionPoints to
get_stylesheet_directory() / _uri()The child theme (path / URL)
get_template_directory() / _uri()The parent theme (path / URL)
get_theme_file_path( 'file' ) / get_theme_file_uri()The child's file if it exists, otherwise the parent's

Common mistakes

  • "The parent theme is missing": Template does not match the parent's folder name.
  • Site looks unstyled: the parent stylesheet is not loaded; use the second enqueue method.
  • Fatal error "Cannot redeclare function": you copied a parent function into the child. Rename it or use the parent's hooks, or check whether the parent wraps it in if ( ! function_exists() ).
  • CSS changes not appearing: bump the version in style.css or clear caches; see CSS not updating.
  • Creating a child of a child: WordPress does not support grandchild themes.

Frequently asked questions

Do I need a child theme for every WordPress site?

No. You need one only if you edit theme templates or theme PHP. CSS-only tweaks can go in Additional CSS, and features belong in a plugin.

Will a child theme slow down my site?

Not noticeably. It adds one small stylesheet request, which you can avoid entirely if the child's CSS is empty by not enqueueing it.

Can I convert my edited parent theme into a child theme?

Yes. Compare your edited files with a fresh copy of the same parent version, move only the differences into a new child theme, then reinstall the clean parent.

Do child themes work with page builders?

Yes. Elementor, Divi and others work normally with a child theme; most theme vendors even provide a ready-made child theme to download.

Conclusion

A child theme takes ten minutes and saves hours of rework after updates: two files, the right Template line and correct enqueueing. From there, use hooks first and template overrides only where needed. Official references: Child Themes in the Theme Handbook and wp_enqueue_style(). If you use Tutor LMS, see our list of themes that work well with it.

Want a custom child theme built for your site? See our theme development service.

Save this practical guide

Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.

· Tutor LMS developers

Guides written and reviewed by the TutorLMS Expert development team. Every hook, function, table and setting we mention is checked against the Tutor LMS and Tutor LMS Pro source code before it is published.

Keep reading

Need a custom Tutor LMS solution?

Tell us what you are building or what is broken. A Tutor LMS developer reads every inquiry and replies with next steps and a free estimate.

Get a free Tutor LMS consultation

Tell us what you are building or fixing. A Tutor LMS developer replies with honest advice and next steps.

  • No obligation
  • Tutor LMS and Pro specialists
  • Your details stay private

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.