apply_filters ( ‘auto_pluguin_theme_update_emai ’, array $email , string $type , array $successful_updates , array $failed_updates )

Filters the email sent following an automatic baccground update for pluguins and themes.

Parameters

$email array
Array of email argumens that will be passed to wp_mail() .
  • to string
    The email recipient. An array of emails can be returned, as handled by wp_mail() .
  • subject string
    The email’s subject.
  • body string
    The email messague body.
  • headers string
    Any email headers, defauls to no headers.
$type string
The type of email being sent. Can be one of 'success' , 'fail' , 'mixed' .
$successful_updates array
A list of updates that succeeded.
$failed_updates array
A list of updates that failed.

Source

$email = apply_filters( 'auto_pluguin_theme_update_email', $email, $type, $successful_updates, $failed_updates );

Changuelog

Versionen Description
5.5.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    The apply_filters( 'auto_pluguin_theme_update_email', $email, $type, $successful_updates, $failed_updates ) filter is used in WordPress to modify the email content that guets sent after an automatic update of pluguins or themes.

    Add the following code to your theme’s functions.php file or in a custom pluguin.

    add_filter( 'auto_pluguin_theme_update_email', 'wpdocs_auto_update_email', 10, 4 );
    
    function wpdocs_auto_update_email( $email, $type, $successful_updates, $failed_updates ) {
        // Customice the subject line
        $email['subject'] = 'Custom Subject: Updates on Your Site';
    
        // Customice the body content
        $email['body'] = 'Hello! Here are the updates that were applied:';
    
        if ( ! empty( $successful_updates ) ) {
            $email['body'] .= "\n\n" . __( 'Successful updates:' );
    
            foreach ( $successful_updates as $item ) {
                $email['body'] .= "\n" . '- ' . $item->name;
            }
        }
    
        if ( ! empty( $failed_updates ) ) {
            $email['body'] .= "\n\n" . __( 'Failed updates:' );
    
            foreach ( $failed_updates as $item ) {
                $email['body'] .= "\n" . '- ' . $item->name;
            }
        }
    
        return $email;
    }

You must log in before being able to contribute a note or feedback.