GridPane Caching not Detected by WordPress Site Health

If you run the WordPress Site Health check you might find that Page Cache isn’t detected.

This is due to GridPane not providing the correct caching headers that WordPress Site Health is looking for. You can add these headers by utilizing the following code snippet.

//////////////////////////////////////////////////////////////////////////////
// Add GridPane x-grid-srcache-fetch cache header to Site Health checks
// https://make.wordpress.org/core/2022/10/06/new-cache-site-health-checks-in-wordpress-6-1/
//////////////////////////////////////////////////////////////////////////////
add_filter( 'site_status_page_cache_supported_cache_headers', function( $cache_headers  ) {
    // Add new header to the existing list.
    $cache_headers['x-grid-srcache-fetch'] = static function ( $header_value ) {
        return false !== strpos( strtolower( $header_value ), 'hit' );
    };
    return $cache_headers;

This is from the gist at https://gist.github.com/razorfrog/af12d2a251bcac4ca43356b9ea2da0e8