One of the things I’m starting to add to my plugins and themes is custom contextual help text for my settings pages. This is also something I’d love to see more plugin and theme developers start adding to their projects.
There’s a few great benefits to adding contextual help text:
- Provides quick documentation to your users.
- Helps cut back on support questions.
- Gives you an opportunity to link directly to the full documentation or support forums.
What is contextual help text?
If you open any screen in the WordPress admin, you should notice a tab near the top of the page labeled “Help” as shown in the following screenshot.

After clicking the tab, a new panel slides open that offers additional information. Most screens in the WordPress admin provide useful information to the users about what actions they can perform depending on which screen they are viewing.
However, for custom admin pages (such as those found in plugins and themes), WordPress doesn’t know what to show. So, it just adds a link to the WordPress documentation and support forums. That’s not user friendly.
This tutorial will walk you through the steps of adding custom help text for your plugin and theme admin pages.
Adding contextual help text
This will only take a few lines of code in your plugin file or theme’s functions.php file. The biggest thing to keep in mind is that this is contextual text. This means that the text changes depending on what admin screen is currently being viewed by the user. Therefore, you need to make sure you’re only adding text shown for your plugin/theme.
For this, you’ll use the add_contextual_help() function, which takes in two parameters: $screen (the current admin screen) and $text (the help text to show for the screen).
add_contextual_help( $screen, $text );
The following is a sample code snippet that shows how this works.
add_action( 'admin_menu', 'my_admin_setup' );
function my_admin_setup() {
/* Custom help message. */
$text = '<p>' . __( 'This is an example of contextual help in WordPress, you could edit this to put information about your plugin or theme so that users will understand what the heck is going on.', 'example-textdomain' ) . '</p>';
/* Add documentation and support forum links. */
$text .= '<p><strong>' . __( 'For more information:', 'example-textdomain' ) . '</strong></p>';
$text .= '<ul>';
$text .= '<li><a href="http://yoursite.com/theme-documentation">' . __( 'Documentation', 'example-textdomain' ) . '</a></li>';
$text .= '<li><a href="http://yoursite.com/support">' . __( 'Support Forums', 'example-textdomain' ) . '</a></li>';
$text .= '</ul>';
add_contextual_help( 'appearance_page_theme-settings', $text );
}
appearance_page_theme-settings is the screen name for a theme settings page. Figuring out the correct screen name for your plugin/theme is described later in this tutorial.
Thanks to Andrew Nacin for reminding about this method.
Filtering the contextual help text
Another method to adding contextual help text is filtering the contextual_help hook. The following is an example code snippet demonstrating how to add a filter to this hook.
You’ll use the $screen variable to check if the current screen is your plugin or theme’s admin screen. If you’re not sure what the name of your admin screen is, see the next section of this tutorial.
/* Add your filter to the 'contextual_help' hook. */
add_filter( 'contextual_help', 'my_admin_contextual_help', 10, 2 );
function my_admin_contextual_help( $text, $screen ) {
/* Check that we're on our theme/plugin settings screen. */
if ( 'appearance_page_theme-settings' == $screen ) {
/* Custom help message. */
$text = '<p>' . __( 'This is an example of contextual help in WordPress, you could edit this to put information about your plugin or theme so that users will understand what the heck is going on.', 'example-textdomain' ) . '</p>';
/* Add documentation and support forum links. */
$text .= '<p><strong>' . __( 'For more information:', 'example-textdomain' ) . '</strong></p>';
$text .= '<ul>';
$text .= '<li><a href="http://yoursite.com/theme-documentation">' . __( 'Documentation', 'example-textdomain' ) . '</a></li>';
$text .= '<li><a href="http://yoursite.com/support">' . __( 'Support Forums', 'example-textdomain' ) . '</a></li>';
$text .= '</ul>';
}
/* Always return the help tab text. */
return $text;
}
Note this line of code from the sample code:
if ( 'appearance_page_theme-settings' == $screen ) {
appearance_page_theme-settings is the screen name for a theme settings page. It will change for each custom admin page you add.
How to find the admin screen name
There are several functions for adding administration pages in the WordPress admin. I’ll assume you’re already familiar with the WordPress documentation on administration menus. Each of these functions returns the name of the page added for your plugin/theme.
Suppose you were adding a page under the Appearance menu in the admin. You’d use the add_theme_page() function as shown in the following code.
$my_theme_page = add_theme_page(
__( 'Theme Settings', 'example-textdomain' ),
__( 'Theme Settings', 'example-textdomain' ),
'edit_theme_options',
'theme-settings',
'my_settings_page_callback'
);
The return value of add_theme_page() is the name of the page added. So, $my_theme_page will be appearance_page_theme-settings.
Your final code for adding contextual help text might look something like the following.
add_action( 'admin_menu', 'my_admin_setup' );
function my_admin_setup() {
$my_theme_page = add_theme_page(
__( 'Theme Settings', 'example-textdomain' ),
__( 'Theme Settings', 'example-textdomain' ),
'edit_theme_options',
'theme-settings',
'my_settings_page_callback'
);
if ( $my_theme_page )
add_contextual_help( $my_theme_page, '<p>Some custom help text.</p>' );
}
I want to see some help text
Now that I’ve taken some time to write out this tutorial, it’s your turn. If your plugin or theme creates custom admin pages, I want to see some custom help text when I click the “Help” tab.
I hope you enjoyed the tutorial and can use it in your plugins and themes.

Thanks for this! I’ve often wondered how this worked and will indeed begin to include help on stuff I write. Most of my work is custom stuff focused on one particular client rather than generalized plugins that can be distributed, but that doesn’t mean I want to get 2 AM phone calls from clients who need me to explain this or that capability of something I made them!
It can definitely be helpful with clients. Whenever I do custom plugin work with admin pages, I always make sure to add that little bit extra help text. It saves both me and the client time.
Why create Half when you can Create Whole!
You can also use add_contextual_help() — easier to use than the filter. Assuming the following code is attached to the admin_menu hook, try this:
That’s what I get for writing these things late at night. I always leave out important things.
Post updated.
I do like using a filter better in some scenarios though. It just depends.
This is what I get for writing replies late at night:
add_theme_page() might return false instead of a slug if the user doesn’t have the proper capability. So you need to check for that as well. (Otherwise it throws a notice, so not a huge deal.)
I’ve added some phpdoc to the various submenu functions to document this return value. I also might add a sanity check to add_contextual_help().
Nice! That will definitely help developers.
nice guide.. i’ve followed everything but at the end i cant find $my_theme_page. ??? What’s my problem? Any mistakes I’ve done or I went to the wrong page?
It’s tough to say without seeing the code in question.
Good finishing touch is to automagically open contextual help when user visits page for the first time (or is having issues, etc).
I got answers with couple handy JS snippets for that on WPSE:
http://wordpress.stackexchange.com/questions/10810/how-to-control-contextual-help-section-by-code
You could couple that with a little user metadata to check if they’ve already seen and closed the help tab. It’d be interesting to see the full code for something like that.
In MailChimp STS plugin I had implemented it to auto-open if user hadn’t yet set up and saved required settings:
http://plugins.trac.wordpress.org/browser/mailchimp-sts/tags/0.9.2/mailchimp-sts.php#L759
Thanks Justin, that is very helpful!
Thanks, I’ll roll that into the next release of my published plugin and incorporate into those being readied for publication.
You might like to consider using get_plugins() to read plugin details so that the plugin site URL can be read from the readme instead of duplicating it.
Justin, found your post via Summify. Best one yet, hands down. I’ve PAID for WP ebooks that didn’t give me anywhere near such directly actionable info (none of your books
.
Thank you in the grand spirit of sharing WordPress expertise…already coded for my most difficult client’s site, thank you thank you thank you. Works like a charm or three.
I love to see writers (especially popular/published folks) quickly and thoughtfully respond to insightful comments from their readers. I can only imagine how busy you are…awesome how you handled the standout additions from Andrew N. (oh yeah, thanks Andrew!) Too many times I’ve seen (pop/pub) authors dismiss or ignore critical remarks about a particular post. Never understood that. Thanks for reaffirming my faith in blogging this morning.
Great post Justin….looking forward to trying this out…
Hey Justin,
First, I would like to say that I just recently found your site and I’m liking your articles tremendously.
Now on to this post in particular; I think this is a step in the right direction for plugin and theme developers. I’m a strong believer that the better your documentation, the better received your software product will be.
No one wants to hunt down how to use a particular function in your piece of software. The more hoops that you make the end user jump through, the less likely they are going to continue using your software; no matter how much it fits their needs. They will either change their requirements, or find another plugin or theme that has better documentation included.
This doesn’t mean to say that all of the information for the help needs to be included in the plugin/theme itself… Using the contextual help menu allows for quick and easy access to the help and support that ANY user will need. No more searching for answers… No more attrition of users.. Think of the customer loyalty that you can build by making yourself, the programmer/designer, more accessible to the user for any issues that may arise from the use of your plugin/theme.
Way to go! This is definitely a step in the right direction. I commend your efforts.
This is awesome.. It will be easier for us bloggers/writers who are not technically knowledgeable with coding and programming.
So the “current admin screen” was difficult to figure out because as far as I can tell there’s no real documentation on what the screens are called… unless I totally missed it. It seemed obvious after the fact but “settings_page_” wasn’t clearly obvious… something that should be listed.
Anyways.. got mine up and running; now just have to write good help documentation.
Cheers
Nicely stated Justin. The more you give a client to learn from the less they return to you with questions.
A thought on that, for any creatives out there reading this: Why not build a simple Documentation plugin that accepts generic parameters? In a way it would likely work like a FAQ but be able to be called with the same ease as get_option().
Just thinking outside the box for a portable, easy to implement solution.
Now, as a master in the english language, Justin, I’m actually surprised you didn’t make a comment or three about effective documentation writing techniques. Not everyone is a writer and programmers are certainly amongst the many who simply shouldn’t.
Justin – another excellent article and so useful to have all this information all in one place – I hope a linkback to this page is added to the codex – I have yet to find a better tut on the topic
Thanks Justin, nice guide indeed!
Thought it’s just the opinion of Robb, I do say kudos for the progress on contextual help.
As blogging continues to move into being commonplace for the masses of everyday users, these types of improvements will be what enables things to move ahead gracefully.
Thanks Justin, that nice guide is very helpful!
Very clever! We really need an elaborate help instructions. I bet more developers will be inspired by this!
I added cont. help to theme, works great, i am satisfied, clients too
Nice! That will definitely help developers.
Justin, this is awesome! Is there a way to add video instead of text?
Really usefull I was looking for contextual help. Thanks!
Thanks for the guide! I always rush though this type of things when programming. I found this very useful.
I was looking for this tutorial thanks google which bring me here, now i will put it to my blog thanks Justin Tadlock very helpful for me.
Than You Justin! This article was very helpful to me!
Great article Justin,
Is there a way to add new custom named tab which will be displayed on all pages within WordPress admin?
Thanks for this Justin! That method for extracting the current screen name came in handy when detecting Pages within WP e-Commerce’s Admin menu entry.
Thanks Justin, this solved a big problem for me on how to update help files across a multisite network. I had been using a plugin, and editing each site was a pain in the gazitchka.
I would like to enhance it a bit, if possible, so I have a question.
Is there a way to modify the color of the contextual help tab so it stands out a bit from the bland background that Wordpress comes with? A red, yellow, or goldenrod tab would add a lot to the useability … mainly by allowing it to be easily recognized by less than observant users.