How to Enable Debugging in WordPress

With Servebolt, you already have access to PHP error logs. Sometimes, this isn’t enough, and this is where WordPress’s debug system comes in handy. In addition, you can use this tool to debug and clean up code, ensuring the overall quality of your WordPress site.

Where to find your WP-config file

To enable debugging, we first need to edit your wp-config.php file. The easiest way to continue would be to log into the server with SSH. Here, you have the availability to use built-in text editors like nano or vim making this a quick and easy process.

#Navigate to your web root
cd ~/public

#Edit your wp-config.php file
nano wp-config.php

We have help articles on connecting with SSH for Mac and Windows. If you wish to use SFTP, you first need to download your wp-config.php file (the lines are shown below) with a local text editor and upload the modified file again. Find information on how to connect with SFTP here.

Enabling WordPress debugging: What to add to your WP-config file

Add the following lines of code at the bottom of your file but above the line /* That's all, stop editing! Happy publishing. */

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Image showing wp-config.php with nano editor
  • WP_DEBUG is what enables the debug mode. It is recommended to change the second parameter to false when you are not using the debug mode.
  • WP_DEBUG_LOG generates a debug.log file in your /wp-content/ directory. This is a great way to see the entire log of errors.
  • WP_DEBUG_DISPLAY is off to prevent error codes from showing on your site. This setting is great for debugging each page individually but should be off when your site is live. It’s best used for staging or development sites.

Now you are ready to test your site functionality, and whenever you find anything that does not work as intended, an error message should appear in wp-content/debug.log. We also offer tools like WP Profile and WP Doctor, which help you check for potential performance issues and general faults with your WP installation.

If you have any additional questions or need extra help, please contact our support chat and we’ll be happy to help!