Debugging PHP Fatal Errors in the WordPress debug.log File
Enabling the debug.log
To capture PHP fatal errors, add the following to wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Errors are written to wp-content/debug.log.
Reading Fatal Errors
A fatal error entry looks like:
[20-Sep-2026 10:00:00 UTC] PHP Fatal error: Uncaught TypeError in /var/www/wp-content/plugins/myplugin/class.php:42
Stack trace:
#0 /var/www/wp-includes/class-wp-hook.php(308): myplugin->run()
#1 ...
thrown in /var/www/wp-content/plugins/myplugin/class.php on line 42
The three critical pieces are the error type, the file:line, and the stack trace.
Making the Log Readable
Raw debug logs are dense. Use the FormatHub WordPress Debug Log Parser to isolate fatal errors, separate notices, and render the stack trace as an indented tree.