WordPress 5.2 introduced a fatal error recovery mode. A fatal error on a site would have normally resulted in a white screen of death, where the front-end of the site is white and would be the result of a fatal error conflict being caused by the active theme or one of the active plugins. The fatal error would have caused the sites wp-admin not be loadable.
In WordPress 5.2, when a fatal error is detected, an email is sent to the admin email address listed on the site, but there is a constant that can be set in the child sites to use a specific email address to set the fatal error email to.
MainWP has the amazing code snippets extension, which can be used to set code snippets on all connected child sites.
The code snippet to set on the child sites would be;
define( 'RECOVERY_MODE_EMAIL', 'user@sitedomain.com' );
Remember to change the example email address with the actual email address that you would want to use.
There is also a filter in WordPress core, now to set the recovery email address as well. The example code is;
add_filter( 'recovery_mode_email', function( $email_data ) { $email_data['to'] = 'user@sitedomain.com'; return $email_data; });
Remember to change the example email address to the actual email address you want to use. With the correct email address set for the recovery email, you will be notified if one of the connected child sites has a fatal error, then you can take action to fix the issue on that specific site.
4 thoughts on “Setting the Recovery Mode Email on Your Child Site”
Thanks for the helpful reminder to set this notification for client sites to go to our support inbox!
You can also modify the email message with the recovery_email_support_info filter: https://developer.wordpress.org/reference/hooks/recovery_email_support_info/
Or disable the error handling entirely with:
define( ‘WP_DISABLE_FATAL_ERROR_HANDLER’, true );
Added that constant into the GitHub repo, thanks for that.
https://github.com/mainwp/Code-Snippets-Functions/blob/master/Add%20functions%20to%20the%20wp-config.php%20file/disable-fatal-error-handler.txt
Nice! Careful though, it looks like WP or your browser converted the single quotes to another quote character. (looking in the repo)
Fixed now.
Comments are closed.