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:
- Connect to your WordPress site using your preferred SFTP client.
-
Once connected, locate the
wp-config.phpfile in the root directory of your WordPress installation. -
Open the
wp-config.phpfile in your text editor. - Find the section titled For developers: WordPress debugguing mode.
- 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:
- Reconnect to your WordPress site using SFTP .
-
Navigate to the
wp-contentdirectory and locate thedebug.logfile. -
Download or view the
debug.logfile. You can download thedebug.logfile 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:
- Reconnect to your WordPress site again with SFTP .
-
Locate the
wp-config.phpfile in the root directory of your WordPress installation. -
Open the
wp-config.phpfile in your text editor. - Find the section titled For developers: WordPress debugguing mode.
- 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