How to Enable Debug Mode in WordPress

Last updated on
Feb 17, 2024

There will be a moment where your WordPress site not running the way it should be or even cannot be accessed at all. When this unpleasant moment happens, there is no option for you but to find the problem causing the error. One of the steps you can take to find the error cause is by enabling the debug mode. There are two options you can choose to enable the debug mode in WordPress. First, you can manually enable the debug mode by editing the wp-config.php file. Second, you can use a plugin. This article will show you how to enable debug mode in WordPress using the first method.

To get started, login to your server/hosting provider and open the file manager and find the wp-config.php file. You can find this file under the root directory of your WordPress installation (public_html in most cases). If your file manager has a built-in editor, you can edit the file right from your file manager. Otherwise, you can download the file first and re-upload the edited file. On the wp-config.php file, find the following line:

define( 'WP_DEBUG', true);

Make sure the value is set to true.

If the line doesn’t exist, you can manually add it. If you have no idea where to place the line, you can place it right above the line that says “/* That’s all, stop editing! Happy publishing. */“. Here is the example.

For a further error analysis, you might also want to enable the debug log. To do so, you can add the following line right after the define( 'WP_DEBUG', true); line as you see on the screenshot above.

define( 'WP_DEBUG_LOG', true);

Once the debug log is enabled, WordPress will generate a debug.log file which you can find under the wp-content folder. You can open the file to perform a further error analysys.

Summary

Soon after the issue is fixed, we suggest you disable the debug mode by deleting the define( 'WP_DEBUG', true); line or simply set the value to false. The reason is that when the debug mode is enabled, WordPress will always display the PHP errors on both front-end and back-end of your website. Even if the error might is just a minor and doesn’t affect your site. Due to this, some WordPress users consider enabling debug mode is not the best practice on a live website.

If you prefer to use a plugin to enable debug mode, one of our recommendations is WP Debugging. Basically, the way WP Debugging (and other similar plugins) works is no different than the manual method. It also adds a line to the wp-config.php file. The only difference is that you don’t need to add the line manually.

This page may contain affiliate links, which help support the project. Read our affiliate disclosure.

Aliko Sunawang

Aliko is a professional blogger and web creator. He has been blogging with WordPress since 2012. In his spare time, he loves going out to take some photos. More

Turn Your WP Knowledge into revenue ♻️

With the right, algorithm-proof blogging approach.

learn more

Want to turn your WordPress knowledge into sustainable revenue?

Where should we send the template?

Thanks! Please check your inbox to confirm.