How to disable automated E-Mail on PHP error/exception?

Since WordPress 5.2 there is an automated E-Mail on PHP exceptions. In some smaller projects I just upload the files for new extensions while developing – whenever an error occurs then, the site admin is getting an email. This is usually one of my freelance customers and they unecessarily panic then.

Therefore I would like to turn of this email notifications (without changing the admin email). Is there some kind of action/filter, config option (e.g. define) to disable this behaviour? Some true/false option would be the best? Then I can disable this just for the times I develop.

2 Answers
2

There was some discussion on it a few weeks ago you can find here:
https://make.wordpress.org/core/2019/04/16/fatal-error-recovery-mode-in-5-2/

According to that and looking through the core, you can accomplish that with one of two methods:

define('RECOVERY_MODE_EMAIL', '[email protected]');

OR

add_filter( 'recovery_mode_email', 'recovery_email_update', 10, 2 );
  function recovery_email_update( $email, $url ) {
    $email['to'] = '[email protected]';
    return $email;
 }

Hope that helps!!

Leave a Comment