Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1446
    boardlife
    Participant

    Hi

    I have managed to restrict everything I need for our new user role. But one issue remains. Inside the WP admin there is a topbar which don’t seem to listen to the restrictions I’ve made. From this menu it’s possible to change a lot of settings in the theme etc.

    How to disable this top bar?

    Top Bar admin

    #1447
    Vladimir
    Keymaster

    Hi,

    add to the active theme’s functions.php file this code:

    
    add_action('wp_head', my_hide_admin_menu_bar);
    
    function my_hide_admin_menu_bar() {
           
        if (current_user_can('role_for_which_you_block_admin_bar')) {
            show_admin_bar(false);
        }        
            
    }
    
    #1449
    boardlife
    Participant

    Hi again

    Thanks for your reply. I tried this for contributors and wrote the code like this:

    add_action(‘wp_head’, my_hide_admin_menu_bar);

    function my_hide_admin_menu_bar() {

    if (current_user_can(‘contributor’)) {
    show_admin_bar(false);
    }

    }

    It won’t work. Did I get the code right?

    #1454
    Vladimir
    Keymaster

    Please check if code you inserted into the functions.php contains real single quotes like this “‘”, not as the message above “‘’”.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.