Skip to:
Content
Pages
Categories
Search
Top
Bottom

Disable admin bar

  • @splendorito

    Participant

    Hi,

    is there any way to disable admin bar for users and not for admin?

    Best Regards

Viewing 6 replies - 1 through 6 (of 6 total)
  • @shanebp

    Moderator

    Try this in your theme / functions.php

    function splen_remove_admin_bar() {
    	if( !is_super_admin() ) 
    		add_filter( 'show_admin_bar', '__return_false' );
    }
    add_action('wp', 'splen_remove_admin_bar');

    @modemlooper

    Moderator

    get a plugin from wordpress.org instead theme functions.php should bd code for the theme only

    @hnla

    Participant

    There are times when it’s worth remembering that a theme is not necessarily just a bunch of visuals but the directory that contains the crucial files, without which a site will not function and that not all sites hop around changing themes on a whim which would be very poor practise from a business site point of view. I get why people say a theme should only contain theme related code, but this applies to themes as they might be released to a repo for general download and can not have any notion of what a site user might need to do and then yes theme files mustn’t contain this sort of function, but as asked in this thread and as long as the OP understands what it means to keep that code in a theme that then isn’t portable across themes although perhaps a must always have requirement then it’s fine to add to functions.php.

    @splendorito

    Participant

    Hi,

    Long explanation Hugo but a good one. Yes, i will make specific plugin for this. I’m just getting tired of all plugin here and there. I have like 40 plugins installed. And those i really need.

    Best Regards

    @splendorito

    Participant

    I did find a plugin now that correct this easy.
    Global admin bar hide or remove

    Thank you anyway

    Best Regards

    @modemlooper

    Moderator

    Disagree because the adminbar persists regardless of theme

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disable admin bar’ is closed to new replies.
Skip to toolbar