Automattic / Automattic/studio

Add `SCRIPT_DEBUG` and `WP_ENVIRONMENT_TYPE` toggles to site debug settings

Closed
#4,333 0 comments 0 reactions 1 assignee Claimed by @ryanwelcher View on GitHub
Enhancement Needs Design Settings Studio App YOLO
Dominant language
TypeScript
Stars
517
Forks
95
Avg merge
1d 23h
Merged PRs (30d)
172

Description

### Summary

Studio already lets you toggle `WP_DEBUG_LOG` and `WP_DEBUG_DISPLAY` from a site's settings (added in #2553). I'd like to request two more debug-related constants be exposed in the same place:

- **`SCRIPT_DEBUG`** — [docs](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/#script_debug)
- **`WP_ENVIRONMENT_TYPE`** — [docs](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#wp-environment-type)

### Motivation

Today you can toggle the debug log and error display from the UI, but to change `SCRIPT_DEBUG` you have to **manually edit `wp-config.php`**. That's a problem for a couple of reasons:

- **It's essential for JavaScript block editor work.** With `SCRIPT_DEBUG` enabled, WordPress loads the un-minified/dev builds of core scripts, which surfaces proper, readable React errors (component stack traces, dev warnings) instead of the minified production noise. Anyone developing blocks or working in the editor needs this on regularly.
- **Manual `wp-config.php` edits aren't reliably picked up.** Studio manages `wp-config.php`, and hand-editing it doesn't always get reflected/persisted, so it's fragile compared to a first-class setting.

`WP_ENVIRONMENT_TYPE` is similarly useful to control from the UI — it lets you set the site to `development`/`local`/`staging`/`production`, which affects `wp_get_environment_type()` and the behavior of plugins/themes that branch on it. (Note the closed #165, where `WP_ENVIRONMENT_TYPE` being unset defaulted sites to `production`.)

Being able to toggle these in the **same settings panel** as the existing debug options — with Studio owning the config change — would be much more reliable than editing the file by hand.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.