brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: WP_DISABLE_FATAL_ERROR_HANDLER shows WordPress fatal errors raw while you develop

WordPress
~/tips/tip-wordpress-disable-fatal-error-handler

define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );

Switches off the friendly critical error page so you see the actual PHP error.

Since WordPress 5.2 a fatal error gives you “There has been a critical error on this website” instead of the PHP message. Good for visitors, annoying when you write the code.

On a development site, put this in wp-config.php:

define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );

The first line turns off the fatal error handler, the part of WordPress that catches the error, shows the friendly page and emails a recovery mode link. The other two make PHP show errors in the page. Together you get the real message with the file and line number, which is what you want while breaking things on purpose.

The WordPress docs pair it with those debug lines for that reason. With the handler on, the error is caught before your display settings matter.

I’d never leave it like this on a live site. The handler is what gives you recovery mode: an admin can log in, see which plugin crashed and pause it. Without it, a broken plugin means a white or error page for everyone and no way in through the dashboard. And raw PHP errors show file paths to every visitor. On production, use WP_DEBUG_LOG and read the log file instead.

Further reading: wp-config: Disable the fatal error handler, wp_is_fatal_error_handler_enabled()

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link