Opened 22 months ago
Last modified 15 months ago
#47225 new enhancement
Add new actions to Site Health navigation
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Site Health | Keywords: | site-health has-screenshots has-patch |
Focuses: | administration | Cc: |
Description
The attached patch adds two new actions to allow developers to add new navigation tabs to the Site Health screens.
Attachments (2)
Change History (11)
#1
@
22 months ago
- Component changed from Script Loader to Administration
- Keywords site-health has-screenshots has-patch added
#4
@
21 months ago
- Component changed from Administration to Site Health
Moving Site Health tickets into their lovely new home, the Site Health component.
#5
@
21 months 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.
21 months ago
#7
@
21 months ago
There are several approaches to allow developers to add new navigation tabs.
- Using Actions - With actions developers can inject custom HTML linking to their settings screens.
- 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' ); ?> </a> <?php } 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' );
@desrosj Any updates?