Using WordPress Debug Logging Without Exposing Errors to Visitors Print

  • debug, logs, troubleshooting, wordpress
  • 0

WordPress provides WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY for debugging. On a public site, logging errors is safer than displaying them in page output.

  1. Back up wp-config.php.
  2. Set WP_DEBUG to true.
  3. Set WP_DEBUG_LOG to true.
  4. Set WP_DEBUG_DISPLAY to false and disable PHP display errors for the debugging session.
  5. Reproduce the problem once, then review wp-content/debug.log.
  6. Disable debugging after collecting the necessary evidence.

WordPress recommends debug features for development/staging rather than leaving them enabled permanently on a live site.


Was this answer helpful?

« Back