[ALL THEMES] Turn On/Off Debug Mode

1. Debug Mode

WordPress includes several settings that you can use to help debug the main application, themes, your own custom code, and more.

Generally, these settings are intended for use by developers and should not be used on “live” sites. However, you can also use them in certain scenarios to help troubleshoot issues you may be experiencing with third-party code, such as plugins or themes.

To enable debugging mode in WordPress, follow these steps:

  1. Connect to FTP or login to cPanel > File Manager 
  2. Open the wp-config.php file in your preferred text editor and find this line :
    define('WP_DEBUG', false);
  • To enable debugging mode, replace “false” with “true” in above line. Then you will have this line:
     define('WP_DEBUG', true);

    When this setting is enabled, WordPress displays all PHP errors, notices, and warnings.
    Save your changes and exit the text editor. Debugging mode is now active.

  • When you are done, disable debugging mode by changing the line back to this:
    define('WP_DEBUG', false);

2. Debug Log & Debug Display

If you don’t want error messages published to your site, you should use WP_DEBUG_DISPLAY in conjunction with WP_DEBUG_LOG.

  • WP_DEBUG_DISPLAY will control the display of error messages on both your front end & back end pages
  • WP_DEBUG_LOG can save all error messages to a debug.log file

Below is an example this combination to turn debugging on while error messages are not displayed:

// Turn debugging on
define('WP_DEBUG', true);

// Tell WordPress to log everything to /wp-content/debug.log
define('WP_DEBUG_LOG', true);

// Turn off the display of error messages on your site
define('WP_DEBUG_DISPLAY', false);