mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Site Health: Support custom sub-menus and pages.
Allow developers to extend the Site Health screen with their own custom navigation tabs and pages. This implements a new filter, `site_health_navigation_tabs`, which takes an associated array of tab identifiers/slugs, and tab labels, allowing developers to add their own subpage to the Site Health interface as new tabs. To output a custom page, or add to an existing page, the `site_health_tab_content` action is triggered whenever the `tab` query argument is present and not empty. This action includes the current tab as its argument, which a developer would match against to only output content when relevant. Props ramiy for initial patch. Fixes #47225. git-svn-id: https://develop.svn.wordpress.org/trunk@50764 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -50,6 +50,21 @@ class WP_Site_Health {
|
||||
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_action( 'wp_site_health_scheduled_check', array( $this, 'wp_cron_scheduled_check' ) );
|
||||
|
||||
add_action( 'site_health_tab_content', array( $this, 'show_site_health_tab' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the content of a tab in the Site Health screen.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @param string $tab Slug of the current tab being displayed.
|
||||
*/
|
||||
public function show_site_health_tab( $tab ) {
|
||||
if ( 'debug' === $tab ) {
|
||||
require_once ABSPATH . '/wp-admin/site-health-info.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +118,7 @@ class WP_Site_Health {
|
||||
$health_check_js_variables['site_status']['issues'] = $issue_counts;
|
||||
}
|
||||
|
||||
if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) {
|
||||
if ( 'site-health' === $screen->id && ( ! isset( $_GET['tab'] ) || empty( $_GET['tab'] ) ) ) {
|
||||
$tests = WP_Site_Health::get_tests();
|
||||
|
||||
// Don't run https test on development environments.
|
||||
|
||||
Reference in New Issue
Block a user