WP_DISABLE_FATAL_ERROR_HANDLER vs WP_DEBUG ? What to use and when to use to see errors?

Those constants do different things.

  • The WP_DISABLE_FATAL_ERROR_HANDLER constant is for disabling the new fatal error recovery feature introduced in WordPress 5.2. This new feature ensures that fatal errors from plugins don’t lock you out of your site, and that front-end users get some kind of “technical difficulties” message, rather than a white screen.
  • The WP_DEBUG constant is to enable a debug mode that displays all PHP error messages and warnings on the front-end, as well as WordPress specific messages such as deprecation notices.

So you can see that they are not really related. The fatal error recovery functionality is intended to be used in production, so that white screens and PHP error messages are not displayed to users. While debug mode is intended to be used in a development environment to debug issues when developing a theme or plugin.

In a production environment (so a live site), neither constant should be enabled. Fatal error recovery should be enabled, and debug mode should be disabled.

In a development environment, you probably don’t need fatal error recovery, and you’ll likely want debug mode to be enabled.

If for some reason you need to debug issues on a live site, then debug mode might need to be enabled, but in that case you should have WP_DEBUG_DISPLAY set to false, and WP_DEBUG_LOG set to true, so that you can debug error messages from a log file, rather than exposing them to users.

So in a development environment you probably want:

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

And in a production environment you probably want (these would be the same as not manually defining them):

define( 'WP_DISABLE_FATAL_ERROR_HANDLER', false );
define( 'WP_DEBUG', false );

And if you need to debug a live site you could use:

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