"Get Help" Menu in the Admin Bar
Adds a "Help" menu to the admin bar with links to your support desk, guides and contact details, so clients always know where to turn when something is unclear.
Opens WPIDE on
Code
// Label => URL.
$wpide_help_links = array(
'Open a support ticket' => 'https://example.com/support',
'Editing guide' => 'https://example.com/guide',
'Email us' => 'mailto:[email protected]',
);
add_action( 'admin_bar_menu', function ( $admin_bar ) use ( $wpide_help_links ) {
if ( ! is_user_logged_in() || ! current_user_can( 'edit_posts' ) ) {
return;
}
$admin_bar->add_node( array(
'id' => 'wpide-help',
'parent' => 'top-secondary',
'title' => '<span class="ab-icon dashicons dashicons-sos" style="margin-top:2px" aria-hidden="true"></span><span class="ab-label">Help</span>',
) );
foreach ( $wpide_help_links as $label => $url ) {
$admin_bar->add_node( array(
'id' => 'wpide-help-' . sanitize_title( $label ),
'parent' => 'wpide-help',
'title' => esc_html( $label ),
'href' => esc_url( $url ),
'meta' => array( 'target' => 0 === strpos( $url, 'mailto:' ) ? '' : '_blank', 'rel' => 'noopener' ),
) );
}
}, 5 );
Notes
Edit the links in $wpide_help_links; they open in a new tab.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.