How to Easily Enable WordPress Debug Mode to Fix Site Errors

Debug log file

Are you encountering strange errors on your WordPress site? Debug mode can help you quickly identify and fix issues.

In this comprehensive guide, we‘ll show you how to enable WordPress debug mode using two easy methods.

What is WordPress Debug Mode and Why Use It?

The WordPress debug mode displays all warnings and fatal errors on your site. It logs them in a debug.log file.

Enabling debug mode is useful when you want to diagnose problems caused by:

  • Conflicts with plugins, themes, or custom code
  • PHP errors and exceptions
  • JavaScript conflicts
  • Database issues

With debug mode enabled, you can pinpoint the cause of errors without having to deactivate plugins one by one.

Debug mode reveals issues that may not be visible on the front-end of your site. It‘s an invaluable tool for troubleshooting WordPress problems.

Method 1: Enable Debug Mode Using a Plugin

The easiest way to activate debug mode is by using a plugin. We recommend WP Debugging.

Follow these steps:

  1. Install and activate the WP Debugging plugin.

  2. Go to Tools > WP Debugging in your dashboard.

  3. Check the box for "Set WP_DEBUG to true" and save changes.

WP Debugging settings

  1. You‘ll now see a "Debug Quick Look" menu in your admin bar.

  2. Click on "View File" to open the debug log.

This will display all errors and warnings on your site without having to edit any files manually.

When you‘re done debugging, simply deactivate the WP Debugging plugin to disable debug mode.

Method 2: Manually Enable Debug Mode

You can also activate debug mode by manually editing your wp-config.php file.

Here‘s how to do it:

  1. Use an FTP client or file manager in cPanel to access your wp-config.php file located in the root directory.

  2. Download a copy of wp-config.php to your computer as a backup.

  3. Open the file in a text editor and add the following code before the stop editing comment:

define(‘WP_DEBUG‘, true); 
define(‘WP_DEBUG_LOG‘, true);
  1. Save your changes and upload the file back to your server.

  2. To view the debug log, access /wp-content/debug.log and open it in a text editor.

  3. When finished debugging, edit wp-config.php again and set WP_DEBUG to false.

Don‘t forget to backup your files before making edits. Avoid leaving debug mode enabled on a production site.

Viewing the Debug Log File

To see all recorded errors and warnings, you need to access the debug.log file located in wp-content.

Download the file via FTP or cPanel and open it in a text editor like Notepad or Sublime Text.

The log will display information to help troubleshoot issues:

Debug log file

With this info, you can now identify and fix the problems.

Wrap Up

We hope this guide helped you learn how to easily enable WordPress debug mode. Activating it when needed allows you to rapidly troubleshoot site errors.

Just don‘t forget to disable debug mode when you‘re done fixing issues. Leaving it on permanently can cause performance and security problems.

Let us know if you have any questions in the comments!

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.