Commit 6af32c813a for wordpress.org
commit 6af32c813a5b9a451dcfb833a7df9ed2b8a10233
Author: Weston Ruter <weston@xwp.co>
Date: Tue Nov 4 08:50:35 2025 +0000
Site Health: Improve messaging for PHP version status.
Previously, the status could be misleading, especially if the check against the WordPress.org API failed. The initial status message is now more neutral, and a dedicated check has been added to handle cases where the API is unreachable.
Developed in https://github.com/WordPress/wordpress-develop/pull/7350
Follow-up to [58832].
Props pbearne, joemcgill, mukesh27, peterwilsoncc, swb1192, krupajnanda, psykro, SergeyBiryukov, swissspidy, imranhasanraaz, amin7, flixos90, vgnavada, audrasjb, adamsilverstein, Presskopp, westonruter.
Fixes #61623.
Built from https://develop.svn.wordpress.org/trunk@61123
git-svn-id: http://core.svn.wordpress.org/trunk@60459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php
index d97d4f996a..8388d7ad37 100644
--- a/wp-admin/includes/class-wp-site-health.php
+++ b/wp-admin/includes/class-wp-site-health.php
@@ -728,8 +728,8 @@ class WP_Site_Health {
$result = array(
'label' => sprintf(
- /* translators: %s: The recommended PHP version. */
- __( 'Your site is running a recommended version of PHP (%s)' ),
+ /* translators: %s: The server PHP version. */
+ __( 'Your site is running PHP %s' ),
PHP_VERSION
),
'status' => 'good',
@@ -739,11 +739,7 @@ class WP_Site_Health {
),
'description' => sprintf(
'<p>%s</p>',
- sprintf(
- /* translators: %s: The minimum recommended PHP version. */
- __( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site’s performance. The minimum recommended version of PHP is %s.' ),
- $response ? $response['recommended_version'] : ''
- )
+ __( 'PHP is one of the programming languages used to build WordPress. Newer versions of PHP receive regular security updates and may increase your site’s performance.' )
),
'actions' => sprintf(
'<p><a href="%s" target="_blank">%s<span class="screen-reader-text"> %s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
@@ -755,8 +751,36 @@ class WP_Site_Health {
'test' => 'php_version',
);
+ if ( ! $response ) {
+ $result['label'] = sprintf(
+ /* translators: %s: The server PHP version. */
+ __( 'Unable to determine the status of the current PHP version (%s)' ),
+ PHP_VERSION
+ );
+ $result['status'] = 'recommended';
+ $result['description'] = '<p><em>' . sprintf(
+ /* translators: %s is the URL to the Serve Happy docs page. */
+ __( 'Unable to access the WordPress.org API for <a href="%s">Serve Happy</a>.' ),
+ 'https://codex.wordpress.org/WordPress.org_API#Serve_Happy'
+ ) . '</em></p>' . $result['description'];
+ return $result;
+ }
+
+ $result['description'] .= '<p>' . sprintf(
+ /* translators: %s: The minimum recommended PHP version. */
+ __( 'The minimum recommended version of PHP is %s.' ),
+ $response['recommended_version']
+ ) . '</p>';
+
// PHP is up to date.
- if ( ! $response || version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) {
+ if ( version_compare( PHP_VERSION, $response['recommended_version'], '>=' ) ) {
+ $result['label'] = sprintf(
+ /* translators: %s: The server PHP version. */
+ __( 'Your site is running a recommended version of PHP (%s)' ),
+ PHP_VERSION
+ );
+ $result['status'] = 'good';
+
return $result;
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index d146ad7425..cd1caba45d 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.9-beta2-61122';
+$wp_version = '6.9-beta2-61123';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.