Plugin to hide admin menu (vertical menu bar)

I am learning to write WordPress plugin and testing out a simple case: hide the admin bar base on user role. So far I have the following in my plugin file:

$hidemenu= new HideMenu();
class HideMenu
{
    function hideMenu() {
        add_filter( 'show_admin_bar' , array($this, 'hideAdminBar'));
    }

    function hideAdminBar() {
            if (!(current_user_can("administrator")) 
                            return false;
    }
}

This is base on the example given in WordPress reference. Any idea why this is not working?

Related posts

Leave a Reply

1 comment