[wp-trac] [WordPress Trac] #47225: Add new actions to Site Health navigation
    WordPress Trac 
    noreply at wordpress.org
       
    Mon Jun 24 16:57:18 UTC 2019
    
    
  
#47225: Add new actions to Site Health navigation
-------------------------------------------------+-------------------------
 Reporter:  ramiy                                |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.3
Component:  Site Health                          |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  site-health has-screenshots has-     |     Focuses:
  patch                                          |  administration
-------------------------------------------------+-------------------------
Comment (by ramiy):
 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.
 2. **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' );
 }}}
-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47225#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list