Skip to content

Enable WP_DEBUG

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

This feature is available on sites with a paid WordPress.com plan once the site’s hosting features are activated.

Before you enable WP_DEBUG

WordPress.com logs your site’s PHP errors and web server requests by default, without WP_DEBUG. You can view, filter, and download them under Logs in the Hosting Dashboard, as covered in View your site logs. With SSH access, run cat /tmp/php-errors to read the PHP error log from the command line.

You can still enable WP_DEBUG. While WP_DEBUG_LOG is on, WordPress writes PHP errors to debug.log instead of your site logs. The debug.log file counts toward your site’s storage and grows until you delete it, so turn debugging off and delete the file once you’ve finished.

Enable WP_DEBUG

To activate debugging mode, take the following steps:

  1. Connect to your site with SFTP.
  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 debugging mode.
  5. Update the code to look like this:
if ( ! defined( 'WP_DEBUG') ) {
	define( 'WP_DEBUG', true );
	if ( WP_DEBUG ) {
		define( 'WP_DEBUG_DISPLAY', false );
		define( 'WP_DEBUG_LOG', true );
	}
}
  1. Save the changes you made to the wp-config.php file.

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

Read more about these settings, and the other debugging settings you can enable, in the WordPress Advanced Administration Handbook.

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

Once you’ve finished debugging, disable WP_DEBUG on your production site to prevent performance issues and keep sensitive information secure. To disable it, take the following steps:

  1. Reconnect to your site 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 debugging mode.
  5. Update the code to look like this:
if ( ! defined( 'WP_DEBUG') ) {
	define( 'WP_DEBUG', false );
}
  1. Save the changes you made to the wp-config.php file.
  2. Delete the debug.log file from the wp-content directory.

Last updated: November 25, 2026