Table of contents

Introduction

Whether you’re building a custom theme, installing new plugins, or troubleshooting a sudden error, debugging mode in WordPress is a tool that helps to detect what’s happening behind the scenes. When it is enabled, it reveals valuable information about your site’s inner workings.

In this guide, we’ll walk you through how to safely enable and disable debugging on your WordPress website, whether you’re in development mode or maintaining a live site.

What is WordPress debugging?

WordPress includes a built-in system for reporting errors and warnings, known as WP_DEBUG. This is a PHP constant that, when enabled, helps expose issues such as:

  • Syntax errors in custom code
  • Incompatible plugins or themes
  • Deprecated WordPress functions
  • PHP warnings and notices

When used correctly, debugging mode is one of the fastest ways to understand what’s going wrong with your WordPress site. 

How to enable debug mode

Step 1: Access Your WordPress Files

You’ll need access to your site files using

  • cPanel File Manager
  • FTP (e.g., FileZilla)
  • Hosting File Manager

Locate the wp-config.php file in your site’s root directory.

Step 2: Edit the wp-config.php File

Open wp-config.php and find the line that says:

/* That’s all, stop editing! Happy publishing. */
Insert the following code just above that line:


define( ‘WP_DEBUG’, true );

define( ‘WP_DEBUG_LOG’, true ); 

define( ‘WP_DEBUG_DISPLAY’, false );

What Each Line Means:

  • WP_DEBUG: Turns on debugging mode.
  • WP_DEBUG_LOG: Saves all errors to a log file (wp-content/debug.log).
  • WP_DEBUG_DISPLAY: Hides the errors from showing on the site (recommended for live or semi-live environments).

How To Disable Debugging

Once you’re done troubleshooting or moving to a live environment, it’s crucial to disable debugging to avoid exposing errors to your visitors.

Change the same lines in wp-config.php to:

define( ‘WP_DEBUG’, false);

define( ‘WP_DEBUG_LOG’, false); 

define( ‘WP_DEBUG_DISPLAY’, false );

Best Practices When Using Debugging

  • Never show debug errors on live websites.
  • Regularly check the log file (wp-content/debug.log) when debugging is on.
  • Delete or clear your log file periodically to avoid clutter.
  • Disable debugging once you’re done to keep your site secure and optimised.

Conclusion

Debugging is one of the most overlooked but powerful tools in WordPress. With just a few lines of code, you can turn your site into a feedback machine that helps you catch errors fast and fix them with confidence.

Whether you’re developing custom themes or simply fixing a broken plugin, knowing how to enable and disable safely debugging puts you in full control of your site.

  • Need help debugging your site or building something custom? WPSlay is here to support you, from technical fixes to full-scale development.