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:
- Connect to your site with SFTP.
- 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 debugging mode. - 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 );
}
}- Save the changes you made to the
wp-config.phpfile.
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:
- 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
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:
- Reconnect to your site 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 debugging mode. - Update the code to look like this:
if ( ! defined( 'WP_DEBUG') ) {
define( 'WP_DEBUG', false );
}- Save the changes you made to the
wp-config.phpfile. - Delete the
debug.logfile from thewp-contentdirectory.
Last updated: November 25, 2026