WP_Screen::add_help_tab() WordPress Method

The add_help_tab() method allows you to add a help tab to the WordPress admin screen. The help tab will contain information about the screen and will be visible to any user who can view the screen. The tab will be added to the end of the list of tabs on the screen.

WP_Screen::add_help_tab( array $args ) #

Add 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.


Top ↑

Parameters

$args

(array)(Required)Array of arguments used to display the help tab.

  • 'title'
    (string) Title for the tab. Default false.
  • 'id'
    (string) Tab ID. Must be HTML-safe and should be unique for this menu. It is NOT allowed to contain any empty spaces. Default false.
  • 'content'
    (string) Optional. Help tab content in plain text or HTML. Default empty string.
  • 'callback'
    (callable) Optional. A callback to generate the tab content. Default false.
  • 'priority'
    (int) Optional. The priority of the tab, used for ordering. Default 10.


Top ↑

Source

File: wp-admin/includes/class-wp-screen.php

	public function add_help_tab( $args ) {
		$defaults = array(
			'title'    => false,
			'id'       => false,
			'content'  => '',
			'callback' => false,
			'priority' => 10,
		);
		$args     = wp_parse_args( $args, $defaults );

		$args['id'] = sanitize_html_class( $args['id'] );

		// Ensure we have an ID and title.
		if ( ! $args['id'] || ! $args['title'] ) {
			return;
		}

		// Allows for overriding an existing tab with that ID.
		$this->_help_tabs[ $args['id'] ] = $args;
	}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0The $priority argument was added.
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.