Skip to content

Instantly share code, notes, and snippets.

@Idealien Idealien/functions.php
Last active May 11, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.