This function is used to get the sidebar to the Contextual Help menu in an admin page. The sidebar appears to the right-side of the main help content.
get_help_sidebar() is a method of the WP_Screen class, and can not be called directly.
<?php
$screen = get_current_screen();
$sidebar_html = $screen->get_help_sidebar();
?>
Append a reminder to search the WordPress Codex for more information to every contextual help screen. You may need to use an if
or switch
statement if you want to customize the help sidebar on help screens that only contain tabs you added.
add_action('admin_head', 'my_custom_help'); function my_custom_help () { $screen = get_current_screen(); $sidebar_html = $screen->get_help_sidebar(); $my_sidebar = '<p>You might also be able to find more help by searching for it on the WordPress codex!</p>'; $newsidebar = $sidebar_html . $my_sidebar; // Append my new sidebar content. $screen->set_help_sidebar($newsidebar); }
get_help_sidebar() is located in wp-admin/includes/screen.php
.