From d72a0092d5e0d3a3ae5f5ea1a46335995d56c467 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 6 Apr 2019 15:27:33 +0000 Subject: [PATCH] Site Health: Display a correct error message for a failing request in `wp_version_check()` test. Props Clorith, axaak. Fixes #46814. git-svn-id: https://develop.svn.wordpress.org/trunk@45118 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-site-health-auto-updates.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/wp-admin/includes/class-wp-site-health-auto-updates.php b/src/wp-admin/includes/class-wp-site-health-auto-updates.php index 8e6ef9ac6a..90046ee6b4 100644 --- a/src/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/src/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -106,6 +106,17 @@ class WP_Site_Health_Auto_Updates { $test = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout' ) ); + if ( is_wp_error( $test ) ) { + return array( + 'description' => sprintf( + /* translators: %s: Name of the filter used. */ + __( 'Could not confirm that the %s filter is available.' ), + 'wp_version_check()' + ), + 'severity' => 'warning', + ); + } + $response = wp_remote_retrieve_body( $test ); if ( 'yes' !== $response ) {