• Hi guys! I manage to remove the toolbar if the user is not administrator by using this :

    if ( ! current_user_can( 'manage_options' ) ) {

    show_admin_bar( false );
    `}

    but still, when I go to the User Profile, I still see the
    “Show Toolbar when viewing site” Option, which is logically wrong.
    How can I remove that option?

Viewing 3 replies - 1 through 3 (of 3 total)
  • This solution is not very subtle and could still be subverted by a motivated hacker/user, there has to be an better way to do this:
    Add this to yout style.css:
    tr.show-admin-bar { display:none; }
    The issue is that the control is only hidden.
    Maybe there is a way to filter the <tr>...</tr> that encloses the tick box out of the page ? Anyone ?

    Make sure you are using a child theme first. You can use this following code in functions.php:

    if ( ! current_user_can('manage_options') ) {
         add_filter('show_admin_bar', '__return_false');
    }

    Hi!

    On my site, users _need_ to see the admin bar, otherwise a lot of stuff isnt working. As the user above, I want to remove the option “Show Toolbar when viewing site” from the profile page, so nobody can accidentally unselect it. Is this somehow possible?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to remove "Show Toolbar when viewing site" option in User Profile?’ is closed to new replies.