From 70ce16235cf6e2221fec373f6184dbd86e371696 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 24 Jul 2026 13:24:57 +0530 Subject: [PATCH 01/14] Fix inconsistencies for dashbaord widget if no js --- src/wp-admin/includes/dashboard.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index a0b0ac6c77239..44efbf3d99cbd 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -661,6 +661,9 @@ function wp_dashboard_recent_drafts( $drafts = false ) { $drafts = get_posts( $query_args ); if ( ! $drafts ) { + echo '
'; + echo '

' . __( 'There are no recent drafts.' ) . "

"; + echo '
'; return; } } @@ -1190,7 +1193,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar $doing_ajax = wp_doing_ajax(); $loading = '

' . __( 'Loading…' ) . '

'; $loading .= wp_get_admin_notice( - __( 'This widget requires JavaScript.' ), + __( 'The WordPress Events and News feeds require Javascript. Please enable it from browser settings.' ), array( 'type' => 'error', 'additional_classes' => array( 'inline', 'hide-if-js' ), @@ -1377,7 +1380,7 @@ function wp_dashboard_events_news() { * @since 4.8.0 */ function wp_print_community_events_markup() { - $community_events_notice = '

' . ( 'This widget requires JavaScript.' ) . '

'; + $community_events_notice = '

' . ( 'The WordPress Events and News feeds require Javascript.' ) . '

'; $community_events_notice .= ''; $community_events_notice .= ''; @@ -2003,7 +2006,7 @@ function wp_dashboard_site_health() { $issues_total = $issue_counts['recommended'] + $issue_counts['critical']; ?>
-
+

' . __( 'Loading…' ) . '

'; $loading .= wp_get_admin_notice( - __( 'The WordPress Events and News feeds require Javascript. Please enable it from browser settings.' ), + __( 'The WordPress Events and News feeds require Javascript.' ), array( 'type' => 'error', 'additional_classes' => array( 'inline', 'hide-if-js' ), From f9da1450cbeb6b3aeb200a60cd4ffd72f5b02714 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 24 Jul 2026 13:32:43 +0530 Subject: [PATCH 03/14] Fix phpcs fixes --- src/wp-admin/includes/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 75063fdaa49c4..af0fad5b67762 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -662,7 +662,7 @@ function wp_dashboard_recent_drafts( $drafts = false ) { $drafts = get_posts( $query_args ); if ( ! $drafts ) { echo '
'; - echo '

' . __( 'There are no recent drafts.' ) . "

"; + echo '

' . __( 'There are no recent drafts.' ) . '

'; echo '
'; return; } From dd36c5bc142b3034ee48e6c17dc9c112e772be77 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 24 Jul 2026 13:34:15 +0530 Subject: [PATCH 04/14] Fix copilot feedbacks --- src/wp-admin/includes/dashboard.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index af0fad5b67762..255cb3fa4094f 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1193,7 +1193,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar $doing_ajax = wp_doing_ajax(); $loading = '

' . __( 'Loading…' ) . '

'; $loading .= wp_get_admin_notice( - __( 'The WordPress Events and News feeds require Javascript.' ), + __( 'The WordPress Events and News feeds require JavaScript.' ), array( 'type' => 'error', 'additional_classes' => array( 'inline', 'hide-if-js' ), @@ -1380,7 +1380,7 @@ function wp_dashboard_events_news() { * @since 4.8.0 */ function wp_print_community_events_markup() { - $community_events_notice = '

' . ( 'The WordPress Events and News feeds require Javascript.' ) . '

'; + $community_events_notice = '

' . ( 'The WordPress Events and News feeds require JavaScript.' ) . '

'; $community_events_notice .= ''; $community_events_notice .= ''; From a66d8afd438f257558899f621991a91bdbc2265b Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 24 Jul 2026 13:38:43 +0530 Subject: [PATCH 05/14] Fix copilot feedbacks --- src/wp-admin/includes/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 255cb3fa4094f..a41e49e55d430 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1380,7 +1380,7 @@ function wp_dashboard_events_news() { * @since 4.8.0 */ function wp_print_community_events_markup() { - $community_events_notice = '

' . ( 'The WordPress Events and News feeds require JavaScript.' ) . '

'; + $community_events_notice = '

' . __( 'The WordPress Events and News feeds require JavaScript.' ) . '

'; $community_events_notice .= ''; $community_events_notice .= ''; From 8fcf993d1e719235c892114b66369224c66dcd4b Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 24 Jul 2026 16:50:26 +0530 Subject: [PATCH 06/14] Add hide-if-no-js on the progess div --- src/wp-admin/includes/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index a41e49e55d430..bb084b5971297 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -2007,7 +2007,7 @@ function wp_dashboard_site_health() { ?>
-
+
'; - echo '

' . __( 'There are no recent drafts.' ) . '

'; + echo '

' . __( 'There are no recent drafts.' ) . '

'; echo '
'; return; } From 25c01b2e8b51f8da001268fd06928bca5c9a122a Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Thu, 20 Aug 2026 17:01:26 +0530 Subject: [PATCH 08/14] Update the visiblity of entire site-health widget when there is no-js --- src/wp-admin/includes/dashboard.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index daa6913a9223d..f2c0d73dbe473 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -65,6 +65,9 @@ function wp_dashboard_setup() { wp_enqueue_style( 'site-health' ); wp_enqueue_script( 'site-health' ); + // The widget's data is loaded via JavaScript, so hide the whole widget when JavaScript is disabled in browser. + add_filter( 'postbox_classes_dashboard_dashboard_site_health', 'wp_dashboard_site_health_postbox_class' ); + wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' ); } @@ -1820,6 +1823,23 @@ function dashboard_browser_nag_class( $classes ) { return $classes; } +/** + * Adds a class to the Site Health dashboard widget's meta box. + * + * The widget's data is loaded via JavaScript, so the whole widget is hidden + * when JavaScript is disabled. + * + * @since 7.1.0 + * + * @param string[] $classes Array of meta box classes. + * @return string[] Modified array of meta box classes. + */ +function wp_dashboard_site_health_postbox_class( array $classes = [] ): array { + $classes[] = 'hide-if-no-js'; + + return $classes; +} + /** * Checks if the user needs a browser update. * From 27aa72d3ab6db1b124a8ffcc422d23cb8f14d379 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Thu, 20 Aug 2026 17:02:53 +0530 Subject: [PATCH 09/14] Remove the hide-if-no-js from site-health markup as entire widget is now hidden --- src/wp-admin/includes/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index f2c0d73dbe473..33cd4427dacd3 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -2022,7 +2022,7 @@ function wp_dashboard_site_health() { ?>
-
+
'; + echo '
'; echo '

' . __( 'There are no recent drafts.' ) . '

'; echo '
'; return; From 359002986b4737b8f9b7df848657dd221c04180e Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 21 Aug 2026 13:45:51 +0530 Subject: [PATCH 13/14] Remove the change for message from cached widget --- src/wp-admin/includes/dashboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index b89848103b588..f39830311ff50 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1191,7 +1191,7 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar $doing_ajax = wp_doing_ajax(); $loading = '

' . __( 'Loading…' ) . '

'; $loading .= wp_get_admin_notice( - __( 'The WordPress Events and News feeds require JavaScript.' ), + __( 'This widget requires JavaScript.' ), array( 'type' => 'error', 'additional_classes' => array( 'inline', 'hide-if-js' ), From 5522b0d1f77728c2da658f306e2bc52518eadf79 Mon Sep 17 00:00:00 2001 From: hbhalodia Date: Fri, 21 Aug 2026 14:03:03 +0530 Subject: [PATCH 14/14] Hide the site health widget when js is off using css --- src/wp-admin/css/site-health.css | 4 ++++ src/wp-admin/includes/dashboard.php | 20 -------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/wp-admin/css/site-health.css b/src/wp-admin/css/site-health.css index cf6c24e4a955c..f43db18a84efe 100644 --- a/src/wp-admin/css/site-health.css +++ b/src/wp-admin/css/site-health.css @@ -296,6 +296,10 @@ are styled in the Privacy section of edit.css */ } /* Styling unique to the dashboard widget. */ +.no-js #dashboard_site_health { + display: none; +} + #dashboard_site_health .site-health-details { padding-left: 16px; } diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index f39830311ff50..488e01aa92481 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -65,9 +65,6 @@ function wp_dashboard_setup() { wp_enqueue_style( 'site-health' ); wp_enqueue_script( 'site-health' ); - // The widget's data is loaded via JavaScript, so hide the whole widget when JavaScript is disabled in browser. - add_filter( 'postbox_classes_dashboard_dashboard_site_health', 'wp_dashboard_site_health_postbox_class' ); - wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' ); } @@ -1823,23 +1820,6 @@ function dashboard_browser_nag_class( $classes ) { return $classes; } -/** - * Adds a class to the Site Health dashboard widget's meta box. - * - * The widget's data is loaded via JavaScript, so the whole widget is hidden - * when JavaScript is disabled. - * - * @since 7.2.0 - * - * @param string[] $classes Array of meta box classes. - * @return string[] Modified array of meta box classes. - */ -function wp_dashboard_site_health_postbox_class( array $classes = array() ): array { - $classes[] = 'hide-if-no-js'; - - return $classes; -} - /** * Checks if the user needs a browser update. *