隐藏WordPress管理面板选项

时间:2014-12-22 21:30:59

标签: wordpress

如何为除一个用户之外的所有人隐藏WordPress管理面板选项。我想隐藏除我以外的所有用户的一些设置选项和主题选项(用户名:jacob)。

4 个答案:

答案 0 :(得分:1)

此代码将隐藏所有用户的管理栏:

show_admin_bar( false );

这个会阻止管理栏被隐藏:

show_admin_bar( false );

因此,如果用户名是jacob,则需要使用条件代码,然后显示管理栏并为其他所有人隐藏它。所以这是完整的代码。

global $current_user;
get_currentuserinfo();
if ( is_user_logged_in() ) { 
if($current_user->user_login == 'jacob') { 
show_admin_bar( true );
} else { 
show_admin_bar( false ); 
 } } else { 
   show_admin_bar( false );
}

您可以在主题的functions.php中使用此代码,也可以为此创建单独的插件。

答案 1 :(得分:0)

Admin Bar Disabler 插件可以为具有角色的用户隐藏管理面板。我希望你是管理员而其他用户不是(因为他们不应该看到面板),所以你可以让Wordpress面板只显示管理员角色。 ;)

https://wordpress.org/plugins/admin-bar-disabler/

答案 2 :(得分:0)

如果您有登录用户,可以在管理员周围重新定位 - 检查权限..

更好的是,发送它们!!

看看这里 - https://wordpress.org/plugins/peters-login-redirect/

我在教会网站上使用它并且效果很好!

谢谢!

答案 3 :(得分:0)

将以下代码添加到主题functions.php

global $current_user; get_currentuserinfo(); if ( is_user_logged_in() ) { 
if($current_user->user_login == 'jacob') { 
    show_admin_bar( true );
} else { 
    show_admin_bar( false ); 
} } else {  }

希望这会对你有所帮助