In this post, I want to address the question, how you can use and extend the help menu, you find in the admin dashboard of WordPress. Usually, this help menu can be found in the top right corner and it gives the user some hints and tips, how to use the current page.
So, lets start with the basics: We have to register a new menu page:
As you know, add_menu_page() returns the ID of the newly created page, which we will need, since we want to hook into the specific load event for this page. We do so by using
add_action( 'load-' . $page_with_help, 'pwh_add_help_tab' );
In this action, we will be able to register our help tab and give it some contents.
Adding the help tab
In the first step, we need to acquire the current screen. This is be done by get_current_screen(). This function returns the current WP_Screen object, which contains – beside others – the help tabs.
In a second step, we will now add our own help tabs, by using WP_Screen::add_help_tab(). A help tab contains an ID, a title and the actual content.
With these two simple steps, we can create our own help tabs, which blend perfectly into WordPress. We can also name a callback function, which does the rendering:
With such a callback function, we have more possibilities to render the output. The callback function can receive two parameters: The current WP_Screen object and the current help tab array:
Once you have registered a help tab, you can also register a sidebar for the help. This is done quite simple by set_help_sidebar(). Once, you open the help section, you can see the sidebar on the right side of it:
It is very simple to add a little bit more help for the users of your plugins. So, just do it 🙂
Latest posts by David Remer (see all)
- BuddyPress Desktop Notification 0.7 Release - January 14, 2016
- The problem of slug identification in the repository - August 11, 2015
- WordPress Support Ticket - August 10, 2015
This post is also available in: German