Skip Navigation

[Resolved] I need to hide "Dashboard" in admin menu for some user role

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 7 years ago.

Assisted by: Minesh.

Author
Posts
#593112
2017-11-26_18-49-42.png

I do not want some user role see the menu item "Dashboard". How can i deactivate this item with Toolset Access?

#593241

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you can remove the Dashboard menu item completely by adding following code to your current theme's functions.php file.

function remove_admin_menus () {
    global $menu;
	
	
$restricted = array();	
if (current_user_can( 'editor' ) ) {	
    $restricted = array(__('Dashboard'));
	
	end ($menu);
    while (prev($menu)){
        $value = explode(' ',$menu[key($menu)][0]);
        if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
    }
	
}
    
}
add_action('admin_menu', 'remove_admin_menus');

I've setup example for editor role - if user role = editor then editor user will not be able to see the Dashboard menu. You can adjust above code as per your need.

More info:
=> hidden link