WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#47939 closed defect (bug) (invalid)

recovery_mode_email filter is not firing

Reported by: mubashir.iqbal Owned by:
Milestone: Priority: normal
Severity: critical Version: 5.2
Component: Site Health Keywords:
Focuses: Cc:
PR Number:

Description

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies user with this automated email.
There is a filter inside WP_Recovery_Mode_Email_Service class used to add multiple recipient but that filter is not firing. Following is the filter and how i am trying to add multiple recipient

$email = apply_filters( 'recovery_mode_email', $email, $url );
add_filter( 'recovery_mode_email', function( $email_data ) {
    $email_data['to'] = array('user@example.com', 'abc@example.com');
    return $email_data;
});

Please try to add multiple recipient using this filter and you will know that is not firing for some reason.

Change History (5)

#1 @davidbaumwald
3 months ago

  • Component changed from General to Mail

#2 @garrett-eclipse
3 months ago

  • Keywords reporter-feedback added
  • Version changed from 5.2.2 to 5.2

Hi @mubashiriqbal thanks for the report.

The array should be passed directly to the wp_mail call if the filter is firing so am unsure if the issue is with the filter itself.

I was wondering if your Theme where you have this code is where you're triggering the fatal error? As this could explain why your theme code isn't firing. If you move the code into a plugin or mu-plugin does the issue persist? It might be the code doesn't run as the fatal error being caught is stopping execution of your theme functions.

Thank you
P.S. You can also use the RECOVERY_MODE_EMAIL wp-config.php constant.

#3 @SergeyBiryukov
3 months ago

  • Component changed from Mail to Site Health

#4 @mubashir.iqbal
3 months ago

  • Resolution set to invalid
  • Status changed from new to closed

@garrett-eclipse You are right. I had placed that code into my theme functions.php and the fatal error was preventing the theme functions to execute.

As soon as i moved that code into a separate plugin "recovery_mode_email" filter begin to fire.

#5 @garrett-eclipse
3 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

Thanks for reporting back @mubashiriqbal glad to hear the separate plugin approach worked for you. I submitted a note to the developer reference in hopes to help others.

Note: See TracTickets for help on using tickets.