Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Enable WordPress Debugging Mode? A Clear How-To

· 5 min read · Home Tech

In this article
  1. What Debugging Mode Actually Does
  2. How to Enable Debugging (Step by Step)
  3. Where to Find the Error Log
  4. Common Problems and How to Solve Them
  5. Debugging in Staging vs. Production
  6. Security and Performance Considerations
  7. Frequently Asked Questions

Yes, you can enable WordPress debugging mode by adding a few constants to your wp-config.php file, most importantly WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY. This turns on PHP error reporting so you can see what’s causing white screens, 500 errors, or other mysterious failures.

What Debugging Mode Actually Does

WordPress ships with error reporting turned off by default. When something goes wrong, you often see a blank white page or a generic “There has been a critical error on your website” message. Enabling debug mode tells PHP to surface the underlying errors—warnings, notices, and fatal errors—so you can identify the exact file and line number causing the problem.

There are three main constants you control:

  • WP_DEBUG – The master switch. Set to true to turn on debugging.
  • WP_DEBUG_LOG – When true, errors are written to a log file at wp-content/debug.log instead of (or in addition to) being displayed.
  • WP_DEBUG_DISPLAY – When true, errors are shown directly in the browser. When false, they’re hidden but still logged if WP_DEBUG_LOG is true.

You can also set SCRIPT_DEBUG to true to force WordPress to use the unminified versions of its CSS and JavaScript files, which helps when debugging theme or plugin asset issues.

How to Enable Debugging (Step by Step)

You’ll need to edit your wp-config.php file, located in the root of your WordPress installation. Here’s the standard approach:

  1. Connect to your server via FTP, SFTP, or your hosting file manager.
  2. Open wp-config.php in a plain text editor.
  3. Find the line that says define( 'WP_DEBUG', false ); (it may not exist yet).
  4. Replace it with the following block, or add it just above the line that says /* That's all, stop editing! Happy publishing. */:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Save the file and upload it back. The WP_DEBUG_DISPLAY set to false is the recommended setup for live sites because it prevents errors from being shown to visitors while still recording them in the log file.

Where to Find the Error Log

When WP_DEBUG_LOG is true, WordPress writes errors to a file named debug.log inside your wp-content directory. You can open it with any text editor or view it through your hosting control panel’s file manager. The file is created automatically when the first error is logged; it won’t exist if there are no errors.

If you’re using a managed WordPress host, they may provide a built-in error log viewer in the dashboard. In that case, you may not need to create the file manually—just check the host’s documentation.

Common Problems and How to Solve Them

I added the code but nothing shows up. First, check that you placed the constants in the correct file. Some users accidentally edit wp-settings.php or a theme’s functions.php instead. Also, make sure you’re not using a caching plugin that serves stale pages—clear the cache after making changes.

I see errors on my live site now. That happens if WP_DEBUG_DISPLAY is set to true. Set it to false and rely on the log file instead. Also, consider enabling debugging only temporarily; leaving it on in production can expose sensitive paths and slow down your site.

The debug.log file is huge. That’s normal if you have many notices or warnings. You can truncate it by deleting the file—WordPress will recreate it when needed. But if you see thousands of errors, it’s worth fixing the underlying issue rather than just ignoring them.

I still get a white screen even with debugging on. A white screen can be caused by a fatal PHP error that occurs before WordPress loads the debug settings. In that case, check your server’s PHP error log (often at error_log in the root directory or accessible via your hosting panel). You can also temporarily rename your plugins folder via FTP to disable all plugins and see if the site loads.

Debugging in Staging vs. Production

Best practice is to enable full debugging (with display on) on a staging or local development site, and use the log-only approach on production. This way you can see errors immediately while developing, but you don’t risk exposing them to visitors or search engines.

If you don’t have a staging environment, you can still debug safely on a live site by setting WP_DEBUG_DISPLAY to false and checking the log file. Just remember to turn off WP_DEBUG entirely once you’ve fixed the issue—leaving it on can slow down your site and clutter your logs with minor notices.

Security and Performance Considerations

Debugging mode is a development tool, not a permanent setting. When left on in production, it can:

  • Expose file paths and database details to anyone who triggers an error.
  • Slow your site because every notice and warning is processed and logged.
  • Fill up your disk space with a large debug.log file.

Always disable debugging after you’ve resolved the issue. If you need to keep it on for a while, restrict access to the log file via your server configuration (e.g., deny direct access to debug.log via .htaccess or nginx rules).

Frequently Asked Questions

How do I enable debugging without editing wp-config.php? Some managed hosts offer a “Debugging” toggle in their control panel (e.g., WP Engine, Kinsta). If not, you can use a plugin like WP Debugging, which adds the constants for you. However, editing the file directly is the most reliable and doesn’t require an extra plugin.

What is the difference between WP_DEBUG and SCRIPT_DEBUG? WP_DEBUG turns on PHP error reporting. SCRIPT_DEBUG forces WordPress to use the unminified versions of its built-in JavaScript and CSS files. They serve different purposes—use SCRIPT_DEBUG only when you’re debugging asset loading or theme/plugin script issues.

Why do I see “Deprecated” warnings in my debug.log? These are PHP notices about functions that are outdated but still work. They often come from older plugins or themes. While not critical, they can indicate future compatibility issues. You can safely ignore them for now, but consider updating the source.

Can I enable debugging via wp-cli? Yes, you can use wp config set WP_DEBUG true and wp config set WP_DEBUG_LOG true if you have WP-CLI access. This is handy for developers who prefer the command line.

I enabled debugging and now my site is slow. Why? Logging every error to disk can be resource-intensive, especially if there are many notices. Also, displaying errors on screen adds overhead. Turn off WP_DEBUG_DISPLAY and consider disabling WP_DEBUG_LOG once you’ve captured the error you need.