Skip to main content

wp scaffold child-theme

Overview

Generate a child theme with all required files in seconds — style.css with correct Template header, functions.php with the parent stylesheet enqueue, and optionally a screenshot. Never manually create child theme files again.

What It Does

wp scaffold child-theme creates a new directory in wp-content/themes/ with a correctly structured style.css (child theme header) and a functions.php that enqueues the parent theme stylesheet. This is the safest, fastest way to start a child theme.

Syntax

wp scaffold child-theme <slug> [OPTIONS]

Options

FlagDescription
SLUGChild theme directory name
--parent_theme=SLUGParent theme slug (required)
--theme_name=NAMEHuman-readable theme name
--author=NAMETheme author name
--author_uri=URLAuthor URL
--theme_uri=URLTheme URL
--activateActivate the child theme after creation
--forceOverwrite existing files

Basic Usage

wp scaffold child-theme my-theme \
--parent_theme=twentytwentyfour \
--theme_name="My Custom Theme" \
--author="Jane Doe" \
--activate

Output:

Success: Created '/var/www/html/wp-content/themes/my-theme'.
Activating 'my-theme'...
Success: Switched to 'my-theme' theme.

Generated Files

style.css

/*
Theme Name: My Custom Theme
Author: Jane Doe
Template: twentytwentyfour
Version: 1.0.0
*/

functions.php

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style(
'parent-style',
get_template_directory_uri() . '/style.css'
);
}

Real-World Scenarios

Scenario 1: Scaffold and activate immediately

wp scaffold child-theme my-client-theme \
--parent_theme=astra \
--theme_name="Client Theme" \
--author="Agency Name" \
--activate

Scenario 2: Create child theme for staging review

wp scaffold child-theme staging-child \
--parent_theme=generatepress \
--theme_name="Staging Child" \
--author="Dev Team"

Best Practices

  1. Always scaffold from a child theme — never modify parent theme files directly.
  2. Use --activate to immediately switch to the child theme after creation.
  3. Commit to version control right after creation so changes are tracked from the start.

Quick Reference

wp scaffold child-theme <slug> --parent_theme=<slug>      # Basic
wp scaffold child-theme <slug> --parent_theme=<slug> --activate # Activate immediately

Next Steps