Adds a help tab to the contextual help for the screen.
Description
Call this on the load-$pagenow hook for the relevant screen, or fetch the $current_screen object, or use get_current_screen() and then call the method from the object. You may need to filter $current_screen using an if or switch statement to prevent new help tabs from being added to ALL admin screens.
Parameters
$argsarray
Array of arguments used to display the help tab.
$titlestringdefault: false
Title for the tab.
$idstringdefault: false
Tab ID. Must be HTML-safe and should be unique for this menu. It is NOT allowed to contain any empty spaces.
$contentstringdefault: empty string
Optional. Help tab content in plain text or HTML.
$callbackcallabledefault: false
Optional. A callback to generate the tab content.
$priorityintdefault: 10
Optional. The priority of the tab, used for ordering.
Uses · 2
wp_parse_args()Merges user defined arguments into defaults array.
sanitize_html_class()Sanitizes an HTML classname to ensure it only contains valid characters.
633publicfunctionadd_help_tab($args){634$defaults=array(635'title'=>false,636'id'=>false,637'content'=>'',638'callback'=>false,639'priority'=>10,640);641$args=wp_parse_args($args,$defaults);642643$args['id']=sanitize_html_class($args['id']);644645// Ensure we have an ID and title.646if(!$args['id']||!$args['title']){647return;648}649650// Allows for overriding an existing tab with that ID.651$this->_help_tabs[$args['id']]=$args;652}
History
Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.4.0
The $priority argument was added.from the docblock
3.3.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/class-wp-screen.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.