Opened 3 years ago
Closed 3 years ago
#54340 closed defect (bug) (fixed)
WP_LOCAL_DEV shouldn't be included in Site Health Info
Reported by: | johnbillion | Owned by: | Clorith |
---|---|---|---|
Milestone: | 5.9 | Priority: | low |
Severity: | normal | Version: | 5.2 |
Component: | Site Health | Keywords: | needs-patch good-first-bug |
Focuses: | Cc: |
Description
On the Tools -> Site Health -> Info screen, the WP_LOCAL_DEV
constant is included under the heading "WordPress Constants".
This is not a WordPress constant and isn't used by WordPress. Some popular libraries use this constant but it's not a core constant and is misleading to include it under this heading. A colleague had this constant set in the expectation that it affected the return value of wp_get_environment_type()
, which it does not.
Attachments (2)
Change History (10)
#4
in reply to:
↑ 3
@
3 years ago
What if we changed WP_LOCAL_DEV
to WP_ENVIRONMENT_TYPE
since that is the constant used in wp_get_environment_type()
?
Even though this value is already displayed under the "WordPress" section on the Site Health Info screen. Does it not make sense to list it's constant under this section as well?
#5
@
3 years ago
@bgoewert That sounds like a reasonable solution, yes. Since WP_ENVIRONMENT_TYPE
is a core constant, it could safely be displayed, and since the fallback environment, if an invalid value is defined, this is a perfect and quick way to check that value.
#6
@
3 years ago
Thank you for the patch @sabbirshouvo.
Would you have time to make a small udpate here, as the output should be the actual value of the constant, and not true
, false
, Enabled
, or Disabled
(the Undefined
message is OK to leave in though, if the value is not defined).
There's also a few too many spaces on line 321, the number of indents should match the other elements in the array (this isn't a major issue, and we can fix it before committing, but it's good to keep track of :) ), see the line that triggered that warning below (it only needs a single space to align with everything else in the section):
'WP_ENVIRONMENT_TYPE' => array(
Good catch, this seems to be an artifact of the Health Check plugin, where it did make sense to look for it, but the core implementation should definitely only be checking core-related features.
Adding it to the milestone for the next release.