Toggle WordPress Help Menu

It’s not possible (as far as I know) to currently link directly to a help tab in WordPress. Here’s the jQuery solution I cooked up:


/**
* Toggle the WP help menu tab by linking to the tab id
*
* The anchor must have a `rel` of `wp-help`
*/
$(‘a[rel=”wp-help”]’).click(function() {

// Open the help wrapper if it’s not open yet
if($(‘#screen-meta’).is(‘:hidden’)) {
$(‘#contextual-help-link’).click();
}

// Click on the tab link inside the help wrapper
$(‘#screen-meta a[href*=”‘ + $(this).attr(‘href’).replace(‘#’, ”) +'”]’).click();

// We’re just anchor linking; don’t go anywhere
return false;
});

If the tab’s ID that you pass to `$screen->add_help_tab()` is `example-plugin`, then you could create a link like this: `View the help docs`.

Author: Zack Katz

Zack Katz is the President of Katz Web Services and the developer of WordPress plugins with over 700,000 downloads. He lives in Southwest Colorado with his wife and two cats.

Leave a Reply

Your email address will not be published. Required fields are marked *