How to Log WordPress Errors
To save WordPress errors to a log file without displaying them to visitors:
- Open the
wp-configfile. - 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.