1. Home
  2. Tutorials
  3. Enabling Debugging in WordPress

Enabling Debugging in WordPress

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Dismiss

When enabled, WordPress debug will log any errors detected on your site. This can be key to finding the source of an issue or just learning more details errors on your site.

By default, WordPress debug will be disabled. To enable it, you’ll need to access your site files through either FTP or cPanel.

Once your site files are open, you’ll need to open wp-config.php for editing. This will be located in the root folder of your site.

Open wp-config file for WordPress

The wp-config file contains site-specific configuration settings, such as database information and, potentially, settings added by your hosting provider. For debugging, you’ll need to find this line of code (will generally be near bottom of file):

define('WP_DEBUG',false);

Once you’ve located this, you’ll need to replace it with the following three lines of code:

define('WP_DEBUG',true);
define('WP_DEBUG_DISPLAY',false);
define('WP_DEBUG_LOG',true);

This will enable debugging and, importantly, prevent any logged data from displaying on your site. Instead, a debug log will be saved to your site files.

After saving these changes to wp-config.php, you’ll need to return to your site and replicate the issue you saw earlier. This will ensure that it gets recorded in the new error log.

Then, you can return to your site files and open /wp-content/debug.log.

The contents of an error log can vary a lot depending on the cause and number of issues, but now you should be able to see extra details, such as a file path to the source of a code error, to help you better track down the issue.

Updated on November 15, 2017

Was this article helpful?