Site Health: Ensure that the tests returned by `WP_Site_Health::get_tests()` always have the required array keys: `direct` and `async`.

This avoids PHP notices if these keys were accidentally removed using the `site_status_tests` filter.

Props khag7, Ov3rfly, desrosj, Clorith.
Merges [48808] to the 5.5 branch.
Fixes #50858.

git-svn-id: https://develop.svn.wordpress.org/branches/5.5@48810 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-08-17 02:21:17 +00:00
parent 3212a7dffb
commit fe47413a65
1 changed files with 9 additions and 0 deletions

View File

@ -2207,6 +2207,15 @@ class WP_Site_Health {
*/
$tests = apply_filters( 'site_status_tests', $tests );
// Ensure that the filtered tests contain the required array keys.
$tests = array_merge(
array(
'direct' => array(),
'async' => array(),
),
$tests
);
return $tests;
}