Home » WordPress » WordPress 7.2 WP_DEBUG: What Site Owners Should Know

WordPress 7.2 WP_DEBUG: What Site Owners Should Know

Published 2026-11-26 | WordPress

WordPress 7.2 local debugging default settings

Short answer: WordPress 7.2 changes the default for sites marked as local: if WP_DEBUG is not explicitly set, WordPress turns it on. This helps developers catch problems, but debug notices may appear on screen because WP_DEBUG_DISPLAY still defaults to true. Check WP_ENVIRONMENT_TYPE and your wp-config.php, especially if a public site was mistakenly labeled local.

This behavior is part of the upcoming WordPress 7.2 release. It does not switch debugging on for every WordPress site. The change applies only when the environment type is local and no WP_DEBUG value has already been defined. WordPress currently lists 7.2 RC3 for testing and advises site owners to use a test site rather than production for release candidates.

Step 1: Check your environment type

WordPress uses an environment type to distinguish local, development, staging, and production. The type can be set with the WP_ENVIRONMENT_TYPE constant in wp-config.php or with a server environment variable. If neither is set, WordPress treats the site as production.

Look in wp-config.php for a line like this:

define( 'WP_ENVIRONMENT_TYPE', 'local' );

Also ask your host or developer whether the server sets the same value outside the file. A public site accidentally marked local will receive local defaults, including visible debug notices, so correct its environment classification.

Step 2: Decide whether local debugging should be enabled

For a private development copy, the new default can help reveal PHP warnings and deprecated code while you work. For a site used by visitors, debugging output can disclose file paths, plugin names, or other implementation details. Debugging output is also confusing when it appears in the middle of a page.

The defaults described by WordPress Core are:

Environment type Default WP_DEBUG in WordPress 7.2
local true
development true
staging false
production false

The change matters only when WP_DEBUG is not already defined. An explicit setting in wp-config.php takes precedence.

Step 3: Log issues without displaying them

If you need debugging on a private test site but do not want messages printed into pages, explicitly configure logging. Add or update these lines in wp-config.php before the “That's all, stop editing” comment:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

WordPress documents WP_DEBUG_LOG as a way to write messages to a debug log, commonly wp-content/debug.log. Protect that file from public access, review it only while troubleshooting, and turn debugging off when finished. Logging can contain sensitive paths or request details.

Step 4: Keep production explicit

On a production site, set its environment type correctly and define debugging off if your configuration needs an explicit safeguard:

define( 'WP_ENVIRONMENT_TYPE', 'production' );
define( 'WP_DEBUG', false );

Do not add duplicate define() statements if those constants are already set. If your host manages environment variables or configuration, ask support where the authoritative value is set. Test configuration changes on staging and make a backup before editing wp-config.php.

When debugging a local copy, reproduce the problem and inspect the exact warning before changing a plugin or theme. A warning may identify a deprecated function that continues to work for now, while a fatal error can stop a request. Share the relevant message and context with the developer, but remove passwords, email addresses, and customer details from anything you send.

After testing, verify that the live site still reports the correct environment type and that debugging is off there. A staging copy can intentionally use staging and keep WP_DEBUG off by default, or define debugging explicitly for a controlled investigation. Write down any temporary changes so they are removed when the investigation ends.

For upcoming version testing, follow the WordPress 7.2 upgrade checklist and keep release candidates on a staging or local copy. The WordPress 7.2 testing guide explains safe ways to evaluate pre-release builds.

Common mistakes

  • Assuming the new default applies to production sites. It only changes the unset WP_DEBUG value for the local environment type.
  • Setting a public server to local, which can make debug output visible.
  • Enabling logging but leaving the log file publicly accessible.
  • Defining a constant twice and getting a PHP warning instead of changing its value.
  • Testing a release candidate on the live website.

Sources

Frequently Asked Questions

Does WordPress 7.2 enable WP_DEBUG on every site?

No. The new default applies when WP_ENVIRONMENT_TYPE is local and WP_DEBUG has not already been defined. Development already defaults to debugging on, while staging and production default to off.

Can WordPress debug warnings appear to visitors?

Yes. WP_DEBUG_DISPLAY defaults to true, so notices can appear on screen in the affected local setup. Do not use a local environment type for a public production site, and configure logging without display when appropriate.

How do I keep the old local debugging behavior?

Define WP_DEBUG as false in wp-config.php before WordPress loads. A setting defined there takes precedence over the environment default.

Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.

More in WordPress