Halloween Sale 15% off Ends in See the plans
PHP

Send Fatal Error Emails to Your Developers

Sends WordPress's "your site is experiencing a technical issue" recovery emails to your developers instead of (or as well as) the site owner, so the right people can fix it.

Don’t have WPIDE yet? Install it on your site

Code

$wpide_recovery_devs       = array(); // e.g. array( '[email protected]' ).
$wpide_recovery_keep_admin = true;

add_filter( 'recovery_mode_email', function ( $email ) use ( $wpide_recovery_devs, $wpide_recovery_keep_admin ) {
    $devs = array_filter( $wpide_recovery_devs, 'is_email' );

    if ( $devs ) {
        $current     = $wpide_recovery_keep_admin ? (array) $email['to'] : array();
        $email['to'] = array_values( array_unique( array_merge( $current, $devs ) ) );
    }

    return $email;
} );

Notes

Add your developers' addresses at the top and set $wpide_recovery_keep_admin to false to stop the site owner receiving them; WordPress sends at most one such email per day.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.