Delete a theme
wp_delete_themePermanently delete an installed theme's folder and files via a two-step preview and confirm token; active and parent themes are refused.
Instructions
Delete an installed theme's folder and files. The active theme and its parent theme are refused (wp_activate_theme switches to another theme); a newer version of a theme is installed by wp_update_theme, without deleting it. Returns deleted and stylesheet. Needs delete_themes; refused when DISALLOW_FILE_MODS is set. Permanent: no undo point is recorded. Runs in two steps: a call without confirm_token changes nothing and returns a preview with a confirm_token, and the same call with that token runs it. This guards against a call nobody meant; it does not make the change reversible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stylesheet | Yes | Exact directory name of an installed theme as wp_list_themes reports it, e.g. "twentytwentyfour". Anything else is refused. | |
| confirm_token | No | Confirmation from the preview: a call without it changes nothing and answers with a preview and a confirm_token, and the same arguments with that token run the tool. A token is valid for 10 minutes and only while what it covers is unchanged. |