Activate Theme
wp_activate_themeSafely activate a WordPress theme with automatic health check. After switching, the site's front page is fetched to verify it loads correctly. If a fatal error, white screen, or HTTP 500 is detected, the previous theme is restored automatically within seconds. The user's site is never left broken. Use wp_get_theme_preview_url first to let the user preview before activating.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_id | No | Site ID to target (optional if you have only one connected site) | |
| stylesheet | Yes | Theme slug to activate (e.g. "my-child-theme") |