Retrieves the markup for an accessible tooltip or toggletip.
Returns a button and either a hover/focus triggered tooltip popover or an action triggered toggle tip. Enqueue the wp-tooltip style and script where it is used. Tooltips are used to show the accessible name of a control. Toggletips are used for longer supporting text explaining context.
No Hooks.
Returns
string. Tooltip HTML markup, or an empty string when no content is provided.
Usage
wp_get_tooltip_helper( $content, $args );
$content(string) (required)
Plain-text tooltip content. An empty value returns an empty string.
$args(array)
Arguments for building the tooltip.
Default: array()
id(string)
Unique ID for the popover element. Default: generated unique ID
button(string)
Existing button or a markup. Used instead of generated button. Default: standard button HTML
label(string)
Accessible label for the toggle button. Ignored for tooltips. Default: 'Help', matching the default icon
close_label(string)
Accessible label for the close button. Default: 'Close'
icon(string)
Dashicons icon class for the toggle button. Should match the control's visible label. Default: 'dashicons-editor-help'
class(string)
Additional class(es) for the wrapping element. Default: ''
type(string)
Type of tooltip: either tooltip or toggletip. Default: 'tooltip'
Changelog
Since 7.1.0
Introduced.
wp_get_tooltip_helper() wp get tooltip helper code WP 7.1