Skip Navigation

[Resolved] Remove Bootstrap toolbars from all Visual Editors

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

Problem: I would like to disable the Bootstrap toolbars from all Visual Editors on my site.

Solution: Add the following code to functions.php:

add_filter( 'mce_buttons_3', 'remove_bootstrap_buttons', 999 );
function remove_bootstrap_buttons($buttons) {
return array();
}
 
add_filter( 'mce_buttons', 'remove_bootstrap_toggle_button', 999 );
function remove_bootstrap_toggle_button($buttons) {
$remove = array( 'css_components_toolbar_toggle' );
return array_diff( $buttons, $remove );
}
This support ticket is created 6 years, 9 months 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)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 6 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#612762
Screen Shot 2018-02-05 at 12.39.17.png

Hi there,

For some reason Toolset seems to have started adding additional Bootstrap toolbar items in the editor. This is annoying as there was no option to add it and I see no way of turning it off. I'm getting a lot of complaints from the site users.

Can you please give me precise instructions on how to remove these from the toolbar.

Very best wishes
Andrew

#612929

There are a few things you can do to affect the Bootstrap toolbars display:
1. Disable Bootstrap in Toolset > Settings > General tab > Bootstrap Loading configurations. This completely disables Bootstrap, and removes all the Bootstrap stylesheets and JavaScript enqueued by Toolset. This can cause problems if any content on your site includes Bootstrap styles, like their grid system, responsive utilities, or other components (hidden link).
2. Leave Bootstrap enabled in Toolset > Settings > General tab > Bootstrap Loading configurations, but click the "B" button in the top row of the toolbar, far right (shown in the screenshot you provided). This toggles the Bootstrap toolbars on or off. This option is best if you wish to continue to include Bootstrap stylesheets and JavaScript, and continue to show Bootstrap-styled content on your site.
3. Add custom code that removes the Bootstrap button and toolbars from all text editors. This option is useful if you want to continue to support existing Bootstrap-styled content, but you want to disallow people from using the Bootstrap feature in text editor fields.

Let me know if you are unable to find a suitable option here and we can discuss in more detail.

#613220

Thanks for your reply, Christian.

If you can provide the code for option 3 please, that would be good. I didn't ask for this behaviour, it's an intrusive addition created by Toolset. We already turned off Bootstrap loading in the setting a long time ago, because of intrusive styling added by Toolset. Now you have started showing these toolbars.

As I say, this is non-standard behaviour added to WordPress by your plugin. I never asked for it as part of your plugin and your settings do not work in making it go away.

So please provide the custom code I need to remove the toolbars. I can't ask every user to toggle the toolbars on and off - and some may do things they should not.

Thanks again for your time,
Andrew.

#613480

I see, I overlooked the fact that your site uses Layouts. The settings I mentioned will not apply for your case, because Layouts requires Bootstrap. Please add this code to your child theme's functions.php file to disable Bootstrap toolbars and buttons in Visual Editors:

add_filter( 'mce_buttons_3', 'remove_bootstrap_buttons', 999 );
function remove_bootstrap_buttons($buttons) {
return array();
}

add_filter( 'mce_buttons', 'remove_bootstrap_toggle_button', 999 );
function remove_bootstrap_toggle_button($buttons) {
$remove = array( 'css_components_toolbar_toggle' );
return array_diff( $buttons, $remove );
}

Please let me know if this does not resolve the issue completely. I apologize for the inconvenience you and your site Users have experienced.