diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-admin/includes/class-wp-automatic-updater.php --- a/wp/wp-admin/includes/class-wp-automatic-updater.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-admin/includes/class-wp-automatic-updater.php Fri Sep 05 18:52:52 2025 +0200 @@ -752,7 +752,7 @@ // Send debugging email to admin for all development installations. if ( ! empty( $this->update_results ) ) { - $development_version = str_contains( get_bloginfo( 'version' ), '-' ); + $development_version = str_contains( wp_get_wp_version(), '-' ); /** * Filters whether to send a debugging email for each automatic background update. @@ -795,7 +795,7 @@ * @param object $update_result The result of the core update. Includes the update offer and result. */ protected function after_core_update( $update_result ) { - $wp_version = get_bloginfo( 'version' ); + $wp_version = wp_get_wp_version(); $core_update = $update_result->item; $result = $update_result->result; @@ -936,6 +936,14 @@ return; } + $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); + + if ( $admin_user ) { + $switched_locale = switch_to_user_locale( $admin_user->ID ); + } else { + $switched_locale = switch_to_locale( get_locale() ); + } + switch ( $type ) { case 'success': // We updated. /* translators: Site updated notification email subject. 1: Site title, 2: WordPress version. */ @@ -1139,9 +1147,12 @@ $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result ); wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); + + if ( $switched_locale ) { + restore_previous_locale(); + } } - /** * Checks whether an email should be sent after attempting plugin or theme updates. * @@ -1255,6 +1266,14 @@ } } + $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); + + if ( $admin_user ) { + $switched_locale = switch_to_user_locale( $admin_user->ID ); + } else { + $switched_locale = switch_to_locale( get_locale() ); + } + $body = array(); $successful_plugins = ( ! empty( $successful_updates['plugin'] ) ); $successful_themes = ( ! empty( $successful_updates['theme'] ) ); @@ -1526,6 +1545,10 @@ if ( $result ) { update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); } + + if ( $switched_locale ) { + restore_previous_locale(); + } } /** @@ -1534,9 +1557,12 @@ * @since 3.7.0 */ protected function send_debug_email() { - $update_count = 0; - foreach ( $this->update_results as $type => $updates ) { - $update_count += count( $updates ); + $admin_user = get_user_by( 'email', get_site_option( 'admin_email' ) ); + + if ( $admin_user ) { + $switched_locale = switch_to_user_locale( $admin_user->ID ); + } else { + $switched_locale = switch_to_locale( get_locale() ); } $body = array(); @@ -1715,6 +1741,10 @@ $email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results ); wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); + + if ( $switched_locale ) { + restore_previous_locale(); + } } /**