我只需要在WordPress for Admins中显示“屏幕选项”选项卡,并为其余用户隐藏该选项卡。我怎么能这样做?
我发现了这个:How to Hide the WordPress Screen Options Tab
function remove_screen_options_tab()
{
return false;
}
add_filter('screen_options_show_screen', 'remove_screen_options_tab');
但它为每个用户隐藏了它......
答案 0 :(得分:3)
在主题文件夹中查找functions.php
文件,然后添加以下代码:
function remove_screen_options_tab() {
return current_user_can( 'manage_options' );
}
add_filter('screen_options_show_screen', 'remove_screen_options_tab');
管理员是唯一可以'manage_options'
的人,因此应该有效。