Make WordPress Core

Opened 8 months ago

Last modified 3 months ago

#53230 new enhancement

Allow nested arrays to be displayed in site health.

Reported by: spacedmonkey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: needs-patch
Focuses: ui Cc:


Site health info, if the value is an array, it formats this as a ul / li list. This is nice, but if in the array, are other nested arrays, these are not rendered as expects. This screen should be changed to check if the value is an array and to iterate through it.

Attachments (1)

Screenshot 2021-05-19 at 09.51.48.png (35.3 KB) - added by spacedmonkey 8 months ago.

Download all attachments as: .zip

Change History (2)

#1 @Clorith
3 months ago

I agree, we need to have some better support here, I'm curious what would be the preferred way of doing that though.

What would make the most sense, there's two instant thoughts that come to mind, as I see it:

  1. If it's non-scalar (a quick is_scalar check), "dump" it using JSON encoding, PHP serialization, or the "prettier" option of a pre wrapped print_r.
  2. If it's an array, allow for nested loops.

Option 2 means we need to perhaps be a bit strict on what is allowed to be included, so you can only go X tiers deep at max, to keep it legible.

Option 1 is the one I'm leaning towards, although it may not _always_ look as pretty to the naked eye, it does mean those adding information to the debug section can include "anything" they feel is relevant. It would also allow for any non-scalar value to be output (for that weird edge case where someone has decided to make the data an object instead of an array, unlikely, but if they want to quickly push the data into some tool on their end from the debug output, that would likely make this easier if for example JSON encoding were used?)

Note: See TracTickets for help on using tickets.