From 04e24d2c454c8260aba229eba68d5cb9322c744f Mon Sep 17 00:00:00 2001 From: Nikunj Hatkar Date: Tue, 1 Jul 2025 19:05:03 +0530 Subject: [PATCH 1/4] Add hash handling to site health accordions --- src/js/_enqueues/admin/site-health.js | 15 +++++++++++++++ src/wp-admin/site-health-info.php | 2 +- src/wp-admin/site-health.php | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/site-health.js b/src/js/_enqueues/admin/site-health.js index 416295df69b17..dd410de097f85 100644 --- a/src/js/_enqueues/admin/site-health.js +++ b/src/js/_enqueues/admin/site-health.js @@ -44,6 +44,8 @@ jQuery( function( $ ) { $( '.health-check-accordion' ).on( 'click', '.health-check-accordion-trigger', function() { var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) ); + window.location.hash = $( this ).attr( 'id' ); + if ( isExpanded ) { $( this ).attr( 'aria-expanded', 'false' ); $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true ); @@ -53,6 +55,19 @@ jQuery( function( $ ) { } } ); + // Get hash from query string and open the related accordion. + setTimeout( function() { + var hash = window.location.hash; + + if ( hash ) { + var requestedPanel = $( hash ); + + if ( requestedPanel.length ) { + requestedPanel.trigger( 'click' ); + } + } + }, 100 ); + // Site Health test handling. $( '.site-health-view-passed' ).on( 'click', function() { diff --git a/src/wp-admin/site-health-info.php b/src/wp-admin/site-health-info.php index bfdd77df01553..faffb21636827 100644 --- a/src/wp-admin/site-health-info.php +++ b/src/wp-admin/site-health-info.php @@ -73,7 +73,7 @@ ?>

-