Skip Navigation

[Resolved] Hiding Toolset WYSIWYG field editor buttons from my editors in wp-admin

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to hide the Toolset toolbar buttons above WYSIWYG editor panels in wp-admin for certain User roles.

Solution: You can use the following code snippet to manage the visibility of these buttons in wp-admin:

function tssupp_remove_admin_toolset_buttons(){
  $user = wp_get_current_user();
  if ( is_admin() && !in_array( 'administrator', (array) $user->roles ) ) {
    add_filter( 'toolset_editor_add_form_buttons', '__return_false' );
  }
}
add_action( 'admin_init','tssupp_remove_admin_toolset_buttons', 9 );

Only administrators will see these buttons, but you can adjust the code to support other roles as well.

This support ticket is created 3 years, 1 month 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
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)

Author
Posts
#1981159
Screenshot Toolset WYSIWYG Buttons.png

Wish to hide Toolset WYSIWYG field editor buttons from my WordPress editors.

Do you have a work-around for this or did I miss something?

#1981323

Hi, there's nothing built-in to the software that will help you control the visibility of these buttons to different Users or User roles. We do offer a PHP filter that can be used to programmatically hide the buttons in wp-admin. If you'd like to hide the buttons from all Users who are not administrators, for example, you could use the filter like this:

function tssupp_remove_admin_toolset_buttons(){
  $user = wp_get_current_user();
  if ( is_admin() && !in_array( 'administrator', (array) $user->roles ) ) {
    add_filter( 'toolset_editor_add_form_buttons', '__return_false' );
  }
}
add_action( 'admin_init','tssupp_remove_admin_toolset_buttons', 9 );

Add that code to your child theme's functions.php file. Or, you can add the code to a new snippet in Toolset > Settings > Custom Code tab, set the snippet to run everywhere, and activate the snippet.

#1981829

Hi Christian,

Thanks a lot. Did the job flawlessly.

Mikael

#1982883

Perfect. Feel free to create new tickets as needed, I'll close out here.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.