A Step-by-Step Guide on Enabling WordPress Debug Mode

Blog -
How to Enable Debugging in WordPress

Once your WordPress site is complete, it’s easy to imagine that it is perfect, and as long as no one touches anything, nothing can go wrong. However, bugs can slowly creep in from many sources, such as out-of-date plugins, malware, and other digital demons.

Finding out what is causing your site’s problem in such situations is vital but frustratingly difficult without a little extra know-how. Specifically, you should learn how to enable and use WordPress debug mode.

What is WordPress Debug Mode?

WordPress debug mode is enabled by inserting a small amount of code into the site’s PHP backend. Once enabled, you can see PHP errors and warnings in real-time. You can also enable logging to review these errors after the fact.


To enable WordPress debug mode, follow these steps:

Step 1: Accessing the wp-config.php File

You need to access the root directory of your WordPress installation. You can achieve this through an FTP client (such as WinSCP) or your hosting provider’s file manager. Locate the file “wp config.php” and open it using a text editor. The software we mentioned above has a built-in text editor, so simply double-click on the file to open it and begin editing.

Step 2: Locating the Debugging Section

Find the section that deals with debugging settings within the wp config.php file. This section is usually located towards the end of the file, just before the line that states, “That’s all, stop editing! Happy publishing.”

Step 3: Enabling Debugging

To enable debugging, replace the line: define (‘WP_DEBUG’, false); with the following:

Here’s what each of these lines does:

  • define( ‘WP_DEBUG’, true ); – this line enables the WordPress debug mode.
  • define( ‘WP_DEBUG_LOG’, true ); – this line ensures that all errors get logged to a wp-content/debug.log file in your WordPress directory.
  • define( ‘WP_DEBUG_DISPLAY’, false ); – this line ensures that errors are not displayed to your website’s visitors. As per the previous line, errors are logged in the debug.log file.
  • @ini_set( ‘display_errors’, 0 ); – this line ensures that your visitors are not displayed PHP errors.
  • Step 4: Saving and Uploading the File

    If you are editing your wp_config.php file live on the website, simply save your changes, and you are done.

    If you are working with an offline copy of the wp_config.php file, you need to upload it to the same location as the existing one. You will be prompted to choose whether to overwrite the file, so be sure to do so.

    Step 5: Analyzing the WordPress Debug Log

    Now that your site can record errors in real-time, you have access to a list of errors and timestamps that can help you identify problems. To access the debug.log file, simply go to wp_content/debug.log.

    You can look up the meaning of most debug errors with a simple Google Search, which may lead you to the faulty plugin, update, or theme behind the errors.

    Once you have finished reviewing your debug file, you must disable the feature. Follow the steps above to log back into your site, return the debug section to define (‘WP_DEBUG’, false), and save the file. Failing to do so can cause a very large file to build up in your host space and also leave a security vulnerability that bad actors can exploit.

WordPress Maintenance Service

Get started with one of the Deutrix Care WordPress support plans.

Get Started Get Started