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
- Verify existence with
wp theme listbefore activating. - Flush the cache after activation to ensure the new styles and templates are served.
- If switching to a child theme, ensure the parent is also installed.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: Theme not found | Typo in slug | Run wp theme list to find correct slug |
| White screen after activation | Theme PHP error | Deactivate 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
wp theme list— check available themes.wp theme status— see details of the active theme.