Make WordPress Core

Opened 8 days ago

Last modified 8 days ago

#47864 new enhancement

Provide filters for Site Health Check results

Reported by: Clorith Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: has-patch
Focuses: Cc:


Currently, there's a filter to modify which PHP extensions are checked for, and even which tests to run, but nothing for the actual results.

There are scenarios where someone might want to extend the results, either by providing a more involved description for a given scenario, or maybe even to provide additional actions.

An example might be a hosting provider, PHP extensions are missing, so they add in an action link to the PHP extension manager of their control panel.
Perhaps they wanted to be more direct, they wanted the PHP version check, which recommends the user update, they add in an ajax button that'll switch the PHP version for them on the spot.

Basically, there are many possibilities here, and it would be nice if we offered them up on a nice silver platter.

There is one limitation I'm thinking of though; asynchronous tests.

While direct tests run on the spot, and thus have traditional filters available to them, the asynchronous ones run after the fact via JavaScript. Since we don't have a wrapper for the tests, they rely on whatever added the test creating their own admin-ajax action to capture them.

Are JavaScript filters the way to go for these, or does that create an odd separation between the two?


As for the proposed filter it self, using something like apply_filters( 'site_status_test_result', call_user_func( $test['test'] ), $test_key ) is what I'm looking at, where $test_key is the array key given in the WP_Site_Health::get_tests() list of tests, and can then be used as a reference.

Attachments (1)

47864.patch (2.9 KB) - added by Clorith 8 days ago.

Download all attachments as: .zip

Change History (2)

8 days ago

#1 @Clorith
8 days ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 5.3

47864.patch adds the filter site_status_test_result both to PHP, and with the same name and output for JavaScript on the asynchronous tests.

I'm not familiar with JS inline docs, and I'm not even sure if they are needed when the filter, and data, are the same, so they are not included here for now.

Note: See TracTickets for help on using tickets.