admin管理员组

文章数量:1391981

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.

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.

Share Improve this question edited Jul 5, 2019 at 15:19 Blackbam asked Jul 5, 2019 at 14:53 BlackbamBlackbam 57511 silver badges28 bronze badges 3
  • Do you only want to disable the email notification? If not, setting WP_DISABLE_FATAL_ERROR_HANDLER should deactivate the whole thing – kero Commented Jul 5, 2019 at 15:56
  • @kero It would be better to only disable the email notification. I do not know exactly what the error handler does, therefore I am not sure if it is a good idea to disable it completely. – Blackbam Commented Jul 5, 2019 at 16:01
  • Well with define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', true ); define('WP_DISABLE_FATAL_ERROR_HANDLER',true); you can still see and log the errors, but not mail them – Fanky Commented Aug 8, 2021 at 13:58
Add a comment  | 

2 Answers 2

Reset to default 6

There was some discussion on it a few weeks ago you can find here: https://make.wordpress/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!!

I have thoroughly tested the above suggestions and neither of them work.

The only thing I have found that DOES work is adding the following to "wp-config.php":

define('WP_DISABLE_FATAL_ERROR_HANDLER',true);

本文标签: emailHow to disable automated EMail on PHP errorexception