Available for projects & agency overflow · Quick reply, from the person who does the work

How to create and use a WordPress child theme

Editing a WordPress theme's files directly works, until the theme's next update: every customisation then disappears without warning. A child theme fixes this with just two files.

Describe my issue Send a message

wp-content/themes/mon-theme-enfant/style.css
/*
 Theme Name: Mon Thème Enfant
 Template: nom-du-dossier-du-theme-parent
*/
wp-content/themes/mon-theme-enfant/functions.php
add_action('wp_enqueue_scripts', function () {
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
});

Creating the child theme

  1. Create a new theme folder

    In wp-content/themes, create a folder dedicated to the child theme, separate from the parent theme's folder, which must never be edited directly.

  2. Create the style.css file

    The file header needs a theme name and, crucially, the Template line, which must exactly match the parent theme's folder name, case-sensitive.

  3. Create the functions.php file

    This file needs to enqueue the parent's stylesheet before adding the child's own customisations, so the parent's styles always apply as a baseline.

  4. Activate the child theme

    From Appearance, Themes, the child theme appears as a fully installed theme and activates the same way as any regular theme.

  5. Add customisations progressively

    Any file from the parent theme can be copied into the child theme unchanged to be edited there; WordPress then automatically uses the child theme's version instead of the parent's.

Why this mechanism protects customisations

When a child theme is active, WordPress first looks for each template file in the child theme's folder. If it isn't found there, it automatically falls back to the matching file in the parent theme. This means only the one file being changed needs to be copied into the child theme, rather than duplicating the entire parent theme.

When the parent theme is updated, only the files in the parent folder get replaced by the new version: the child theme's files stay untouched, since they live in a completely separate folder. That's what makes customisations survive updates, unlike a direct edit to the parent theme, which would be overwritten at every update.

Common mistakes

  • Copying every file from the parent theme into the child theme instead of only the ones actually being changed, which cancels out the benefit of the parent's future updates for everything else.
  • Getting the folder name wrong on the Template line: a different case or an incorrect name stops WordPress from linking to the parent theme, and the child theme can't be activated.
  • Forgetting to keep the parent theme installed: WordPress needs both themes present, since the parent is never activated directly but remains essential for the child to work.
  • Trying to change a parent PHP function by redeclaring it identically in the child theme, which triggers a redeclaration error rather than a clean override.

Frequently asked questions

Does a child theme slow down the site?
No, the overhead is negligible: WordPress simply checks whether the file exists in the child theme before loading the parent's, which has no measurable impact on performance.
Can a child theme be created from any parent theme?
In theory, yes, for most standard themes, but some premium themes or ones built around a specific page builder document their own customisation method, worth checking before creating a standard child theme.
Is a child theme needed even for small CSS tweaks?
For simple CSS adjustments, WordPress also offers additional CSS in the Customizer, without creating a child theme. A child theme becomes worthwhile once the customisation touches template files or PHP code.

Describe your need in one minute

A few targeted questions so I can reply with an estimate rather than another questionnaire.

besoin
etat
constructeur (facultatif)
extensions (facultatif)
Please provide an email or a phone number so I can get back to you.

Please provide an email or a phone number so I can get back to you.