Home › Toolset Professional Support › [Resolved] How to hide toolset buttons in wp editor for non-admin users
Problem: I would like to hide the Toolset buttons that appear above the main editor. Only admins should see these buttons.
Solution: Use a custom code snippet:
add_filter( 'toolset_editor_add_form_buttons', function(){ if( current_user_can('administrator') ) { return true; } return false; });
Relevant Documentation:
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Tagged: Toolset Forms
This topic contains 8 replies, has 2 voices.
Last updated by Charles 5 years, 6 months ago.
Assisted by: Christian Cox.
I am trying to hide toolset buttons in wp editor for non-admin users. I can't seem to find any controls in Toolset settings or Access. I do not want to permanently turn it off even for admin but only for certain users who I allow to post. Thank you.
Hi, there are some filters I can show you how to use in custom code. I'm not sure what this means:
"I do not want to permanently turn it off even for admin but only for certain users who I allow to post". Are you saying you want to show the buttons only to specific Users? Are these Users all in the same role, or do you want to manage them by User ID, or some other method?
Sorry for the confusion. Basically to manage roles. Will be good if can hide them from all non-Administrator roles.
Okay we have a custom code snippet you can use to hide the 3 Toolset buttons above the main editor panel
and WYISYWG fieds for all users except Administrators:
add_filter( 'toolset_editor_add_form_buttons', function(){ if( current_user_can('administrator') ) { return true; } return false; });
Thanks. Do I add this in Toolset Settings -> Custom code snippets?
Somehow I cannot see or add anything in the Custom code snippets section. I checked my WP permission /var/www/html/wp-content/, it's 775. It doesn't have the directory "toolset-customizations", so I created one. Rebooted and still not be to access via WP panel.
Okay if you can't access the Custom snippets panel, you can place this code in a child themes' functions.php file. The toolset-customizations folder should also be 0755. If you continue to have trouble with that, feel free to create another ticket and we can investigate in more detail.
Yes, it works putting in child theme's functions.php. Still not sure why Custom code snippets section cannot load, but it's ok. Thanks!
My issue is resolved now. Thank you!