Posted on 4 Comments

Setting the Recovery Mode Email on Your Child Site

Recovery Mode Email on Your Child Site

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', '[email protected]' );

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'] = '[email protected]';
    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.

Get MainWP News and Notifications

Sebastian Moran on Github
Sebastian Moran
Sebastian Moran is a WordPress performance expert and technical liaison for MainWP.

4 thoughts on “Setting the Recovery Mode Email on Your Child Site

  1. 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 );

      1. Nice! Careful though, it looks like WP or your browser converted the single quotes to another quote character. (looking in the repo)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.