I am writing a plugin and I am trying to only display the admin dashboard menu item to specific roles. I have this controlling snippet so far...
// Check User Role
global $current_user;
if( !empty($current_user->roles) ){
foreach ($current_user->roles as $key => $value) {
if( $value == 'administrator' ){
new myplugin_Wp_List_Table();
}
}
}
This isn't working for some reason, when i'm logged in as administrator it doesn't display the menu.
Anyone any ideas?