When WordPress encounters a fatal error, it can enter Recovery Mode and send an email containing a special login link. This allows an administrator to regain access and disable the problem plugin or theme.
By default, this email is sent to the site admin address, but WordPress provides two ways to customize where it goes.
The two approaches
1. Using the RECOVERY_MODE_EMAIL constant
Add this to wp-config.php:
define( 'RECOVERY_MODE_EMAIL', 'user@domain.com' );
This is the simplest and most reliable way to change the recovery email recipient.
Why this is usually the best choice:
- It exists specifically for this purpose
- Runs before plugins and themes are loaded
- Less likely to fail during a fatal error
If all you need to do is change the recipient address, this is the recommended approach.
2. Using the recovery_mode_email filter
Add this to a plugin or your theme’s functions.php:
add_filter( 'recovery_mode_email', function( $email_data ) {
$email_data['to'] = 'user@domain.com';
return $email_data;
});
This method provides more flexibility and allows you to modify the email content as well.
If you need to customizing the recovery email
You can also change the email subject and message:
add_filter( 'recovery_mode_email', function( $email_data ) {
$email_data['to'] = 'user@sitedomain.com';
$email_data['subject'] = 'WordPress Recovery Mode – Action Required';
$email_data['message'] = "A fatal error was detected on your site.\n\n"
. "Use the link below to enter recovery mode:\n\n"
. $email_data['url'];
return $email_data;
});
This is useful when you want to clarify instructions, add context for clients, or adjust messaging based on your setup.
Important limitation:
Because this filter relies on WordPress hooks, it may not run if the fatal error occurs very early. Use it when customization is required — not just to change the recipient.
Recommendation
Use the RECOVERY_MODE_EMAIL constant when you only need to change the recovery email address. It’s simpler, more reliable, and works even if plugins or themes fail to load.
Use the recovery_mode_email filter only when you need extra customization, such as changing the subject line or message..
In recovery scenarios, choosing the simplest option helps ensure the email is actually sent.
Wrap-up
This is a small detail, but it can save you a lot of headaches when your site breaks.
If you’ve run into recovery mode issues or are locked out of your WordPress site, feel free to reach out, I can help you recover it safely.