Skip to main content

wp theme activate

Overview

Instantly switch the site's active theme. This is the command-line equivalent of clicking "Activate" in the Appearance dashboard. It handles both parent and child themes seamlessly.

What It Does

wp theme activate modifies the template and stylesheet options in the database to point to the new theme's directory. It also triggers theme activation hooks.

Syntax

wp theme activate <theme-slug>

Basic Usage

Activate a core theme

wp theme activate twentytwentyfour

Activate a child theme

wp theme activate my-child-theme

Real-World Scenarios

Scenario 1: Emergency theme rollback

# If a new theme update breaks the site
wp theme activate twentytwentythree
wp cache flush

Scenario 2: Environment-specific themes

# In a CI/CD pipeline, activate a maintenance theme during migrations
wp theme activate maintenance-theme
# ... run migrations ...
wp theme activate main-theme

Best Practices

  1. Verify existence with wp theme list before activating.
  2. Flush the cache after activation to ensure the new styles and templates are served.
  3. If switching to a child theme, ensure the parent is also installed.

Troubleshooting

ProblemCauseFix
Error: Theme not foundTypo in slugRun wp theme list to find correct slug
White screen after activationTheme PHP errorDeactivate via wp theme activate twentytwentyfour (restore)

Quick Reference

wp theme activate <slug>               # Activate theme
wp theme list --status=active # Verify active theme
wp cache flush # Flush after activation

Next Steps