WordPress debug mode is a built-in tool that helps identify and fix errors on your website. Whether you're dealing with plugin conflicts, theme issues, or PHP errors, enabling debug mode can help you pinpoint the root cause quickly.
This guide explains how to activate WordPress debug mode manually or with a plugin, along with best practices to ensure safe troubleshooting.
Enabling debug mode in WordPress allows you to:
View PHP warnings and errors
Log issues into a debug file
Test scripts and styles in development mode
Troubleshoot theme or plugin conflicts
wp-config.php
You can turn on debug mode by editing the wp-config.php
file located in your WordPress root directory.
wp-config.php
FileUse an FTP client or your hosting file manager to navigate to the root directory of your WordPress installation.
Find the following line in wp-config.php
:
define( 'WP_DEBUG', false );
Change it to:
define( 'WP_DEBUG', true );
If the line doesn’t exist, add it above this line:
/* That's all, stop editing! Happy publishing. */
To save error messages in a log file, add the following:
define( 'WP_DEBUG_LOG', true );
This will create a debug.log
file inside the /wp-content/
directory.
To prevent errors from showing on your website (recommended for live sites), add:
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
To load non-minified versions of core JavaScript and CSS files (useful for developers), add:
define( 'SCRIPT_DEBUG', true );
If you're not comfortable editing code, you can enable debug mode with a plugin.
Go to Plugins > Add New in your WordPress dashboard.
Search for WP Debugging and click Install Now.
Activate the plugin. It will automatically configure all required constants in wp-config.php
.
When WP_DEBUG_LOG
is enabled, all logged errors are saved to:
/wp-content/debug.log
You can access this file via your file manager or FTP client to review error messages.
Disable debug mode on live sites once troubleshooting is complete to avoid exposing sensitive data.
Use a staging environment for testing themes, plugins, and custom code.
Check file permissions if the debug.log
file isn’t being created (the wp-content
folder must be writable).