WordPress Technical Issue Email: Change the Recipient

Search your inbox for “Your Site is Experiencing a Technical Issue”. If nothing comes up, nothing may have crashed, WordPress may not have sent it, or it went to an address you don’t read, and the inbox alone can’t say which. This guide covers where that email goes, how to redirect it, and the cases where WordPress never sends it. The short version: don’t make it your only alarm. If you never touch code, the first section and the one on when the email goes out are enough; the rest is for doing it by hand.

Skip the code: BccPilot

If you’d rather not touch code, BccPilot, this site’s free plugin on WordPress.org (install it like any other plugin, from Plugins → Add New), can send a hidden copy (Bcc, a copy the other recipients can’t see) of the email to another inbox. Under Settings → BccPilot you enter the address and tick which notifications get copied: critical error emails, automatic update results, new user registrations and comments waiting for moderation. The administrator still gets everything.

It doesn’t copy WooCommerce emails or replace the original recipient, and it can’t fix a site that can’t send mail. Whatever you pick, “When WordPress stays silent” further down is worth reading: it explains why the email may never arrive. If you want to do it by hand, the next two sections show how.

Where the email goes, and how to change it

From here on you need access to the site’s files and some comfort with code. By default the email goes to the administrator address. A constant is a setting written in the configuration file: WordPress checks first for one called RECOVERY_MODE_EMAIL, and if it holds a valid address, that address wins.

  1. Make a backup copy of wp-config.php, WordPress’s main configuration file, which usually sits in the site’s root folder.
  2. Open it (from your host’s file manager or over FTP) and add the line below, above the sentence “That’s all, stop editing!” (if you can’t find it, put it before the line that contains wp-settings.php, and check that RECOVERY_MODE_EMAIL isn’t already defined in the file).
  3. Replace the example address with yours and save.
php wp-config.php
define( 'RECOVERY_MODE_EMAIL', 'tech@example.com' );

If something goes wrong. If the site shows an error after you save, put back the copy of wp-config.php you made in step one: that usually gets the site running again.

If you have server access, WP-CLI (WordPress’s command-line tool) does it in one command (Anchor Hosting covers it too):

bash WP-CLI
wp config set RECOVERY_MODE_EMAIL tech@example.com

One address only. Write two separated by a comma and WordPress’s is_email() function rejects them, so WordPress quietly falls back to the administrator email, with no warning. Several recipients need the filter below.

Bcc or several recipients: the filter

The constant takes one address. For anything else, use a filter, which is a spot where code can change something before WordPress uses it. This one is recovery_mode_email: it gets the email as a list of fields (a PHP array: to, subject, message, headers, attachments) just before it is sent. Set to to an array of addresses if several people should get it, or add a Bcc header, which wp_mail() understands. To use it, create the folder wp-content/mu-plugins/ if it doesn’t exist, and inside it a file called critical-error-copy.php with this content (use a plain text editor, not Word or Pages, and replace the example address with yours):

php wp-content/mu-plugins/critical-error-copy.php
<?php
/**
 * Plugin Name: Critical error email copy
 */

add_filter( 'recovery_mode_email', function ( $email ) {
	$headers          = array_filter( (array) $email['headers'] );
	$headers[]        = 'Bcc: tech@example.com';
	$email['headers'] = $headers;

	return $email;
} );

The original recipient gets the email as before and, normally, can’t see the Bcc address. That depends on how the site sends mail, though: in some setups the Bcc header stays visible in the message source. If the copy has to stay private, check the source of a test email. Several Bcc addresses go in the same header, separated by commas.

If something goes wrong. If the site shows an error after you save, delete the critical-error-copy.php file from your host’s file manager or over FTP: that usually gets the site running again.

There’s nothing to activate: WordPress loads mu-plugins (“must-use” plugins) on its own. A mu-plugin beats the theme’s functions.php here: a plugin that crashes while loading takes the site down before the theme exists, so a filter in functions.php never gets registered. Mu-plugins load before regular plugins and before the theme.

One caveat about the file itself: WordPress only attributes an error to code inside the plugin and theme folders, so a crash inside the mu-plugin sends no email. Keep it to those few lines.

Tested on WordPress 7.1.4 with PHP 8.5.1: an error triggered on wp-login.php sent the email, and the Bcc copy arrived.

When WordPress stays silent

The email comes out of WordPress’s fatal error handler (core code, since WordPress 5.2), and that handler has rules. The error has to be fatal, the kind that halts the page instead of just showing a warning, and come from a file inside a plugin or theme folder. The request has to hit a protected endpoint: the login page, the admin area or certain Ajax actions (requests the browser makes in the background, mostly inside the admin) (is_protected_endpoint()). Recovery mode can’t already be active in that request, the site can’t be a Multisite network (code), an installation that runs several sites together, and the previous email has to be more than 24 hours old, which is the default.

The protected endpoint rule is the one that catches people out. It’s an explicit check in the code, and Trac ticket 46950 is about it. A plugin that only breaks on public pages sends nothing until somebody loads the admin or the login screen. If the site has to stay up, add an external monitor, a service that checks at regular intervals that your public pages respond. If you don’t know where to start, ask whoever looks after the site or your host to turn on an uptime check.

Other reasons it stays quiet

  • The 24-hour window is still open. The limit comes from the recovery_mode_email_rate_limit filter. To reset it by hand, delete the recovery_mode_email_last_sent option (wp option delete recovery_mode_email_last_sent with WP-CLI; without server access, ask whoever runs the site). WordPress writes that option before sending, so a failed send uses up the window too.
  • The fatal error handler is disabled, for example with WP_DISABLE_FATAL_ERROR_HANDLER set to true in wp-config.php. Then WordPress doesn’t handle the error and sends nothing. The wp_fatal_error_handler_enabled filter exists, but plugins, mu-plugins and themes load too late to use it (code); the constant is usually simpler.
  • The site can’t send mail. WordPress’s own code names one possible cause: a host that has disabled the mail() function. If the host doesn’t deliver mail, no email goes out, not even this one, and it’s time to set up sending through an SMTP service (an outside mail server).

What’s inside the email

Besides the link to start recovery mode, the message carries the address of the page where the error happened and, if WordPress can identify a plugin or theme at fault, its name and the error details. The technical information block (debug), which comes before the details, lists the WordPress version, the active theme and its version, the PHP version and, when the culprit is a plugin, that plugin’s version.

Warning. Copy only people who actually need to read this, recovery mode link included. A shared inbox or an address that gets forwarded without control is not a good recipient.

Sources: WordPress source code (trunk branch), files class-wp-recovery-mode-email-service.php, class-wp-recovery-mode.php, class-wp-fatal-error-handler.php and error-protection.php.