Make WordPress Core

Opened 2 months ago

Last modified 4 weeks ago

#47225 new enhancement

Add new actions to Site Health navigation

Reported by: ramiy Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Site Health Keywords: site-health has-screenshots has-patch
Focuses: administration Cc:


The attached patch adds two new actions to allow developers to add new navigation tabs to the Site Health screens.

Attachments (2)

47225.png (18.9 KB) - added by ramiy 2 months ago.
47225.patch (2.0 KB) - added by ramiy 2 months ago.

Download all attachments as: .zip

Change History (9)

2 months ago

2 months ago

#1 @ramiy
2 months ago

  • Component changed from Script Loader to Administration
  • Keywords site-health has-screenshots has-patch added

#2 @desrosj
2 months ago

  • Milestone changed from Awaiting Review to 5.3

#3 @ramiy
6 weeks ago

@desrosj Any updates?

#4 @desrosj
4 weeks ago

  • Component changed from Administration to Site Health

Moving Site Health tickets into their lovely new home, the Site Health component.

#5 @Clorith
4 weeks ago

Quick update for anyone following this. We're investigating how to solve the problem of tabs when it comes to mobile and IE11 compatibility over on the plugin side of things (so that we can test and iterate in the plugin before any core implementation takes place). The relevant GitHub issue is available at https://github.com/WordPress/health-check/issues/344

This ticket was mentioned in Slack in #core-php by ramiy. View the logs.

4 weeks ago

#7 @ramiy
4 weeks ago

There are several approaches to allow developers to add new navigation tabs.

  1. Using Actions - With actions developers can inject custom HTML linking to their settings screens.
  1. Using Filters - We can replace the hardcoded HTML with an array. Developers can filter the array to add new tabs linking to their settings screens.

With actions:

function custom_site_health_tab() {
    <a href="<?php echo esc_url( admin_url( 'some-screen' ) ); ?>" class="health-check-tab">
      <?php _e( 'Label' ); ?>
add_action( 'site_health_after_tabs', 'custom_site_health_tab' );

With filters:

function custom_site_health_navigation_tab( $tabs ) {
  $tabs[] = array(
    'id'    => 'some-unique-id',
    'label' => __( 'Label' ),
    'url'   => admin_url( 'some-screen' )
  return $tabs;
add_filter( 'site_health_navigation_tabs', 'custom_site_health_navigation_tab' );
Note: See TracTickets for help on using tickets.