How to Log WordPress Errors

To save WordPress errors to a log file without displaying them to visitors:

  1. Open the wp-config file.
  2. Add or update the following lines:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Save the file.

WordPress will create a log file at:

/wp-content/debug.log

Note: After troubleshooting is complete, disable Debug Mode to avoid unnecessary logging and improve security.

Was this answer helpful? 0 Users Found This Useful (0 Votes)