Skip Navigation

[Resolved] Hide Bootstap Elements and CSS

This support ticket is created 7 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Pawel Paluch 7 years ago.

Assisted by: Nigel.

Author
Posts
#591853
screen.jpg

Tell us what you are trying to do?
Hide Bootstrap Elements and CSS for all users but admin

Is there any documentation that you are following?
no
Is there a similar example that we can see?
no

Right now all default users (customers, subscribers, editors....) can see under visual editor additional bootstraps elements as well as toolset bars (please see attachment)
Is there any chance to disable it for all users other than admins?

Thank you

#591970

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Pawel

We have filters that can be used to disable the Fields and Views button, the CRED button, and the Access button, which I will describe below, but we currently have no way of disabling the Content Layout Editor button or the Bootstrap buttons, and I will have to add a feature request for that ability to be added.

You need to add the following PHP to your site (in your theme's functions.php file or using a plugin such as Code Snippets):

function remove_toolset_buttons(){

	// only remove buttons on back end for non-administrators
    if ( is_admin() && !current_user_can( 'manage_options' ) ) {

        // remove the Fields and Views button
        add_filter( 'toolset_editor_add_form_buttons', '__return_false' );
   
        // remove the CRED button
        add_filter( 'toolset_cred_button_before_print', '__return_false' );
   
        // remove the Access button for all roles 
        add_filter( 'toolset_editor_add_access_button', function(){

            global $wp_roles;
            $all_roles = array_keys($wp_roles->roles);
 
            return $all_roles;
        } );
    }
}
add_action( 'init', 'remove_toolset_buttons' );

I will make a request about the other buttons. In the meantime the only way to remove those would be to hide them with CSS.

#593066

Thank you Nigel.
I'll be waiting for future update to hide bootstrap icons.
For now...thank you for .php code.