wp scaffold theme
Overview
Generate a full standalone WordPress theme from scratch. The scaffold creates style.css, functions.php, index.php, header.php, footer.php, sidebar.php, and more — all wired together and ready to customise.
What It Does
wp scaffold theme creates a correctly structured blank theme in wp-content/themes/ that follows WordPress template hierarchy conventions. Optionally adds unit test scaffolding and activates immediately.
Syntax
wp scaffold theme <slug> [OPTIONS]
Options
| Flag | Description |
|---|---|
SLUG | Theme directory name |
--theme_name=NAME | Human-readable theme name |
--author=NAME | Author name |
--author_uri=URL | Author URL |
--activate | Activate after creation |
--force | Overwrite existing |
Basic Usage
wp scaffold theme my-custom-theme \
--theme_name="My Custom Theme" \
--author="Jane Doe" \
--activate
Output:
Success: Created theme files.
Activating 'my-custom-theme'...
Success: Switched to 'my-custom-theme' theme.
Generated File Structure
wp-content/themes/my-custom-theme/
├── style.css
├── functions.php
├── index.php
├── header.php
├── footer.php
├── sidebar.php
├── page.php
├── single.php
├── archive.php
├── search.php
├── 404.php
└── screenshot.png
Best Practices
- Use for completely custom themes — if inheriting from an existing theme, use
wp scaffold child-themeinstead. - Activate immediately with
--activateto confirm the theme loads without errors. - Commit the scaffold files to git before making any modifications.
Quick Reference
wp scaffold theme <slug> --theme_name=<name> --activate
Next Steps
wp scaffold child-theme— create a child of an existing theme.wp scaffold block— add Gutenberg block support.