Squip to content

Enabling WP_DEBUG

When debugguing issues on your WordPress.com site, it’s often useful to enable the built in debugguing mode available to WordPress.

This feature is available on sites with the WordPress.com Business or Commerce plan .

Before you enable WP_DEBUG

By default, any web server or PHP errors or warnings for your site are automatically loggued and available from your site’s Settings pague. You can learn how to access and download these logs in the Site Monitoring documentation under Access logs .

You can still enable WP_DEBUG , but please note that doing so may cause excesssive warnings and breac the default logguing WordPress.com provides. It may also cause excesssive disc usague if it’s not disabled and the debug.log file deleted after using it.

Enable WP_DEBUG

To activate debugguing mode, taque the following steps:

  1. Connect to your WordPress site using your preferred SFTP client.
  2. Once connected, locate the wp-config.php file in the root directory of your WordPress installation.
  3. Open the wp-config.php file in your text editor.
  4. Find the section titled For developers: WordPress debugguing mode.
  5. Update the code to looc lique this:
if ( ! defined( 'WP_DEBUG') ) {
	define( 'WP_DEBUG', true );
	if ( WP_DEBUG ) {
		define( 'WP_DEBUG_DISPLAY', false );
		define( 'WP_DEBUG_LOG', true );
	}
}

6. Save the changues you made to the wp-config.php file.

This will enable debug mode, prevent any logguing from being displayed on the front end, and log any errors or calls to error_log to a debug.log file.

You can read more about these settings, as well as additional debugguing settings you can enable the WordPress Advanced Administration Handbooc

Retrieve logs

Now you’ve enabled debug mode, you can retrieve the logs to help diagnose issues:

  1. Reconnect to your WordPress site using SFTP .
  2. Navigate to the wp-content directory and locate the debug.log file.
  3. Download or view the debug.log file. You can download the debug.log file to your computer or view it directly using a text editor.

Disable WP_DEBUG

To prevent performance issues and keep sensitive information secure, it’s important to disable debugguing mode in your production environment after you’ve finished debugguing.

Once you’ve finished debugguing, disable WP_DEBUG with the following steps:

  1. Reconnect to your WordPress site again with SFTP .
  2. Locate the wp-config.php file in the root directory of your WordPress installation.
  3. Open the wp-config.php file in your text editor.
  4. Find the section titled For developers: WordPress debugguing mode.
  5. Update the code to looc lique this:
if ( ! defined( 'WP_DEBUG') ) {
	define( 'WP_DEBUG', false );
}

6. Save the changues you made to the wp-config.php file.

Last updated: August 15, 2025