How to create a WordPress child theme
Home » Blog » WordPress » How to Create a WordPress Child Theme

How to Create a WordPress Child Theme

Updated:   WordPress 2 min read

Your support helps keep this blog running! Secure payments via Paypal and Stripe.


If you are planning to customize your WordPress site by changing templates, CSS, or adding new functionalities, you should create a child theme. Today, I am going to show you how to create a WordPress child theme.

Why use a child theme?

  • A child theme lets you make changes safely without touching the parent theme.
  • When the parent theme updates, your customizations remain safe.
  • It’s smarter than using custom CSS or editor hacks for anything more than minor tweaks.

What you’ll need

  • Basic knowledge of HTML, CSS, and PHP.
  • A test site (local or staging) and a backup before you start—updates can break things if you’re not careful.

Steps to create a WordPress child theme

Let’s say your active theme is a TwentyTwenty Theme. In order to create the child theme, we will do the steps below.

Create a new child theme folder

Go to /wp-content/themes/ and make a new folder. Use a name like twentytwenty-child. You should not use spaces, special characters, or underscores in the folder name. However, you can use a hyphen in the folder name.

Create a style.css

A style.css file with the required header is necessary to register the child theme in WordPress. So we need to create one.

Inside the twentytwenty-child folder, add style.css with this header:

/* 
Theme Name:     Twenty Twenty Child
Theme URL:      https://yourdomain.com
Description:    Twenty Twenty Child
Theme Author:   Apple Rinquest
Author URL:     https://applerinquest.com
Template:       twentytwenty
Version:        1.0.0
Text Domain:    twentytwenty-child
*/

Change all the values accordingly. The most important field is Template. It tells WordPress which parent theme your child theme is based on.

Important

The Template field must match your parent theme’s folder name exactly. (e.g., twentytwenty for the Twenty Twenty theme)

Create a functions.php

In the twentytwenty-child folder, create a functions.php and add this code.

<?php
add_action('wp_enqueue_scripts', 'enqueue_parent_and_child_styles');
function enqueue_parent_and_child_styles()
{
    // Enqueue parent theme stylesheet
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    // Enqueue child theme stylesheet
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( 'parent-style' ),
        filemtime( get_stylesheet_directory() . '/style.css' ) // Use filemtime for cache-busting
    );
}

This loads both parent and child CSS securely.

Activate your child theme

  • Log into WordPress → Appearance → Themes.
  • You should now see “Twenty Twenty Child”. Click Activate.

That’s it. Our child theme is ready. Now you can start to customize your code in the child theme folder.

Related article

How to Migrate Customizer Settings to the Child Theme


Your support helps keep this blog running! Secure payments via Paypal and Stripe.


Senior WordPress Developer (Freelancer)

Senior WordPress Developer (Freelancer)

I’m a professional WordPress and WooCommerce developer based in Chiang Mai, Thailand, with over a decade of experience creating fast, secure, and scalable websites. From custom themes and plugins to full WooCommerce stores, I help businesses build a strong and reliable online presence. Need a freelance WordPress developer you can count on? View my portfolio or get in touch to discuss your project.