X

Add Contextual Help Tabs

This snippet let’s you crete contextual help tabs in WordPress admin. Place this on functions.php or in your plugin file. Create as many helps tabs you need by switching the $screen_id.

Uncomment the echo line to see the current page id.

function mqw_example_contextual_help( $contextual_help, $screen_id) {
    
   # Uncomment this to see actual screen
   # echo 'Screen ID = '.$screen_id.'<br />';
     
    switch( $screen_id ) {
        case 'toplevel_page_settings_page' :
     // To add a whole tab group
            get_current_screen()->add_help_tab( array(
            'id'        => 'my-help-tab',
            'title'     => __( 'How to get started?' ),
            'content'   => __( 'Put any text here bla bla bla ....' )
            ) );
            
            break;
        case 'mi_plugin_page' :
            //Just to modify text of first tab
            $contextual_help .= '<p>';
            $contextual_help = __( 'Your text here.' );
            $contextual_help .= '</p>';
            break;
    }
    return $contextual_help;
}
add_filter('contextual_help', 'mqw_example_contextual_help', 10, 2);

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!