Quick Links Menu in the Admin Bar
Adds a "Quick links" dropdown to the admin bar with the outside tools your team opens every day, such as analytics or support.
Opens WPIDE on
Code
// Label => URL. Links open in a new tab.
$wpide_quick_links = array(
'Google Analytics' => 'https://analytics.google.com/',
'Search Console' => 'https://search.google.com/search-console',
'Email support' => 'mailto:[email protected]',
);
add_action( 'admin_bar_menu', function ( $wp_admin_bar ) use ( $wpide_quick_links ) {
if ( ! current_user_can( 'edit_posts' ) || empty( $wpide_quick_links ) ) {
return;
}
$wp_admin_bar->add_node( array(
'id' => 'wpide-quick-links',
'title' => 'Quick links',
) );
$i = 0;
foreach ( $wpide_quick_links as $label => $url ) {
$wp_admin_bar->add_node( array(
'parent' => 'wpide-quick-links',
'id' => 'wpide-quick-link-' . ( ++$i ),
'title' => esc_html( $label ),
'href' => esc_url( $url ),
'meta' => array( 'target' => '_blank', 'rel' => 'noopener noreferrer' ),
) );
}
}, 100 );
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.