DEV Community

Cover image for How to Enable Debug Mode, Debug Logs, and Display Errors in WordPress
Meghna Meghwani for ServerAvatar

Posted on • Originally published at serveravatar.com

How to Enable Debug Mode, Debug Logs, and Display Errors in WordPress

If you have ever faced a white screen of death or unexplained WordPress errors, you know how difficult troubleshooting can be. Learning how to Enable Debug Mode in WordPress helps you identify errors, generate debug logs, and fix issues faster.

WordPress Debug Mode fixes that. It switches on error reporting, saves detailed logs to your server, and actually tells you what went wrong, where, and why. Most beginners either don’t know it exists or accidentally leave it running after troubleshooting, which creates its own problems.

In this guide, I’ll walk you through every Debug setting inside ServerAvatar’s WordPress Toolkit, what each one does, when to turn it on, when to turn it off, and how to make sense of the logs when something breaks. Whether you’re a developer chasing a plugin conflict or a site owner wondering why your contact form stopped working, this guide has you covered.

TL;DR

  • Debug Mode + Debug Log = production troubleshooting setup
  • Display Errors = local/staging only, never on a live site
  • Logs live at /wp-content/debug.log on your server
  • WordPress Toolkit = point-and-click toggles, no file editing or FTP needed
  • Always disable debug settings after fixing the problem

What Is WordPress Debug Mode?

WordPress Debug Mode is a built-in troubleshooting feature. It catches PHP errors, plugin conflicts, theme issues, deprecated functions, and fatal errors, then logs them to a file or displays them on screen during development.

By default, WordPress suppresses all PHP errors, which is fine for a live site, but absolutely maddening when you’re trying to figure out why something isn’t working.

When Debug Mode is enabled, you’ll see messages like:

  • “Fatal error: Uncaught Error: Call to undefined function…” = a function that doesn’t exist
  • “Warning: Cannot modify header information, headers already sent” = whitespace or output before a redirect
  • Notices about deprecated functions = useful before upgrading PHP versions

Without Debug Mode, those messages disappear, and you’re left guessing. With it on, you get the exact file path, line number, and full error message. That’s the difference between 10 minutes of debugging and 10 hours.

Quick Comparison: Debug Mode vs Debug Log vs Display Errors in WordPress

Most WordPress users think Debug Mode, Debug Log, and Display Errors are the same thing. They’re not. Each one controls a different part of the debugging process, and mixing them up on a live site can expose errors to everyone who visits.

comparison table

Debug Mode, Debug Log, and Display Errors in WordPress

ServerAvatar’s WordPress Toolkit gives you three options in the Debug section. Each one works differently.

1. Debug Mode: The Main Switch

Debug Mode is the master switch. Turn this on, and WordPress switches PHP from silent mode to verbose mode, tracking everything that goes wrong.

What it does:

  • Turns on error tracking in WordPress
  • Writes errors to debug.log in your /wp-content/ folder
  • Does NOT show errors on screen, that’s a separate toggle

When to use it:

  • Anytime you’re actively troubleshooting something.
  • Enable it, reproduce the issue, check the logs, fix the problem, then disable it.

When to leave it off:

  • Any live production site. Leaving it on exposes your file structure to visitors.

2. Debug Log: The Error Journal

Debug Log is where WordPress writes every error, warning, and notice it encounters. This is the file you actually want to read when something breaks. It captures every error, warning, and notice, even ones that happened hours ago while nobody was watching.

What it does:

  • Writes PHP errors to /wp-content/debug.log on your server
  • Keeps a running record until you clear it
  • Catches errors from scheduled tasks, API calls, and background processes

Why this matters:
Most errors happen when no one’s looking, during cron jobs, background updates, or API requests. Debug Log catches them retroactively, even if the error completely crashes your site. The file is still there waiting for you.

What I like about this approach in ServerAvatar:
The log lives on the server, not in your browser. Even if the error crashes your site completely, the log file is still there waiting for you. You don’t need the site to load to see what went wrong.

3. Display Errors: Show Errors on Screen

Display Errors is exactly what it sounds like, instead of logging errors silently, WordPress prints them directly on the webpage. Visitors see them too.

This is the most dangerous setting of the three if left enabled on a production site. You’ll see PHP warnings and fatal errors rendered right in the browser, sometimes exposing file paths, database query details, and code snippets.

When to use it:

  • Local development environments where you want errors visible immediately
  • Staging sites where you have full control over who’s visiting
  • When you need instant feedback without switching to the terminal

When to turn it off and keep it off:

  • Any live, production website. Displaying PHP errors publicly is a security risk and looks unprofessional to your visitors.

The best practice: Use Debug Mode + Debug Log for production troubleshooting. Use Display Errors only on local or staging environments where no visitors will ever see it.

Read Full Article: https://serveravatar.com/wordpress-debug-mode

Top comments (0)