Home › Toolset Professional Support › [Resolved] Split: Can’t hide toolset in dashboard menu – hide it for custom roles
Problem:
How to hide the Toolset menu in admin (backend) for a specific role
Solution:
To hide/remove Toolset menu for a specific user role, you need to use the standard WordPress hook: admin_menu
You can find the proposed solution, in this case with the following reply:
=> https://toolset.com/forums/topic/split-cant-hide-toolset-in-dashboard-menu-hide-it-for-custom-roles/#post-1623699
Relevant Documentation:
=> https://developer.wordpress.org/reference/hooks/admin_menu/
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.
This topic is split from https://toolset.com/forums/topic/cant-hide-toollset-in-dashboard-menu/
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)
Related documentation:
This topic contains 17 replies, has 2 voices.
Last updated by zbyszekZ 4 years, 6 months ago.
Assisted by: Minesh.
Hi Minesh,
I have the same problem. I would like to hide Toolset from administration sidebar for my custom roles.
I created this role via copy of administrator role.
I added your code in this way => https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/
Run it and enabled, but Toolset is still visible in this menu in this custom role user 🙁
Please write me how can I fix it.
Best regards!
Hello. Thank you for contacting the Toolset support.
Can you please tell me for what custom role you want to hide the Toolset menu?
Hi,
Maybe I didn't describe it correctly. My English is not so good, sorry.
I would like to hide "Toolset" link in from administration sidebar.
But only for one custom role.
Like in attachment picture.
Best regards!
Zbyszek
I understand that but for what custom role you want to hide the Toolset menu?
My custom role is named "adminklienta"
You can add the following code to your current theme's functions.php file or "Custom Code" section offered by Toolset:
// Put the code of your snippet below this comment. function remove_toolset_menus(){ global $current_user; if(in_array('adminklienta',$current_user->roles)) { remove_menu_page('toolset-dashboard'); } } add_action( 'admin_menu', 'remove_toolset_menus' , PHP_INT_MAX );
I hope the above solution will help you to resolve your issue.
Thanks for this advice.
I tried it before, but it didn't help me 🙁
Toolset is still visible in menu.
Maybe this problem is connected with it that 'adminklienta' role is copy from 'admin' role with some modifications?
Can you please share access details for the site and tell me for which user you want to hide the Toolset menu.
*** Please make a FULL BACKUP of your database and website.***
I have set the next reply to private which means only you and I have access to it.
Can you please check now, I logged in using the zz and I do not see the Toolset menu in the backend. Please check the screenshot: hidden link
I've installed and activated Types plugin on your install and added the following code:
// Put the code of your snippet below this comment. function remove_toolset_menus(){ global $current_user; if(in_array('adminklienta',$current_user->roles)) { remove_menu_page('toolset-dashboard'); } } add_action( 'admin_menu', 'remove_toolset_menus' , PHP_INT_MAX );
If you do not want to install/activate the Types plugin, you should add the above code to the theme's funcitons.php file.
Hi Minesh,
Now it works good! Thanks a lot! 🙂
Could you write me where was problem?
What did you fix it?
as shared with my previous reply:
https://toolset.com/forums/topic/split-cant-hide-toolset-in-dashboard-menu-hide-it-for-custom-roles/#post-1623699
I've installed and activated Types plugin on your install and added the code I shared to "Custom Code" section.
=> hidden link
Yes, I read it. But I wonder why Types is necessary if you didn't do anything in this plugin?
I thought that only one needed is Access.
Types plugin required because we added the code to the "Custom Code" section which is offered by Types plugin.
You can move the code to functions.php file if you want and disable the Types plugin.
Please feel free to close the ticket 🙂
"Custom Code" section was in only Access, too 🙂
So I understand that this option of Access didn't work without Types?