Hiding top admin bar from Non-Admin users

This topic contains 10 replies, has 4 voices, and was last updated by  Alex Rollin 6 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #401546

    Dave Flanagan
    Free User
    Post count: 81

    I saw in a previous post about hiding the admin bar, saying that it can be hidden through a setting within BuddyPress. I do not have the BuddyPress plugin activated on my website and the WordPress admin bar is still visible for free users. Any help to resolve this issue would be greatly appreciated.

    Thanks
    Dave

    #401566

    Kor
    Moderator
    Post count: 16516

    Hi Dave,

    Try switching it “Off” at GD > General > General as shown on the attached screenshot.

    Thanks!

    #401577

    Dave Flanagan
    Free User
    Post count: 81

    I just saw that setting and it was already set to off so I’m not sure what the issue is.

    #401590

    Paolo
    Site Admin
    Post count: 31206

    Please provide link / admin credentials in a private reply and we’ll follow up.

    Thanks

    #401767

    Dave Flanagan
    Free User
    Post count: 81
    This reply has been marked as private.
    #401778

    Dave Flanagan
    Free User
    Post count: 81

    I still want the admin bar to be visible to admins but ONLY admins. I just can’t figure this out

    #401783

    Paolo
    Site Admin
    Post count: 31206

    Our option hides it for everyone.

    I don’t know if there is a plugin that will hide it for users and not for admin.

    In the wp.org repo there are plenty of options.

    Let us know how it goes,

    Thanks

    #402164

    Dave Flanagan
    Free User
    Post count: 81

    I’ve downloaded a few different plugins but nothing seems to do the trick. I guess i’ll keep trying different plugins

    #402165

    Alex Rollin
    Moderator
    Post count: 27815

    Here’s a link to some untested code, proceed at your own risk, your mileage may vary:

    https://digwp.com/2011/04/admin-bar-tricks/

    (Always backup before inserting random codes.)

    #402169

    Dave Flanagan
    Free User
    Post count: 81

    So I tried this line of code:

    // show admin bar only for admins
    if (!current_user_can(‘manage_options’)) {
    add_filter(‘show_admin_bar’, ‘__return_false’);
    }

    It did not break my site but it did not hide the bar for non-admin users. Maybe I am supposed to modify the code for specific users. I’m not sure. Free users can see the bar but they can not manage any options. The only thing that they can do is logout from the admin bar, that’s it. I guess I’ll just keep looking into different plugins.

    Thanks
    Dave

    #402182

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
Viewing 11 posts - 1 through 11 (of 11 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket