Skip to content

Instantly share code, notes, and snippets.

@Idealien
Last active May 11, 2018 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Idealien/2485679dbb29334e7927ab8e4c68d234 to your computer and use it in GitHub Desktop.
Save Idealien/2485679dbb29334e7927ab8e4c68d234 to your computer and use it in GitHub Desktop.
Custom Admin Bar Links
<?php
add_action('admin_bar_menu', 'custom_toolbar_links', 10, 1);
function custom_toolbar_links($wp_admin_bar) {
$user = wp_get_current_user();
if( in_array( "staff", $user->roles ) ):
$wp_admin_bar->add_node(array(
'id' => 'hotlinks',
'title' => 'Hotlinks',
'href' => '/hotlinks/',
'meta' => array(
'class' => 'hotlinks',
'title' => 'Hotlinks'
)
)
);
$wp_admin_bar->add_node(array(
'id' => 'approvals',
'title' => 'Approvals',
'href' => '/approvals/',
'parent' => 'hotlinks',
'meta' => array(
'class' => 'hotlinks',
'title' => 'Approvals'
)
)
);
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment