我有一个自定义分类法,如果当前用户是管理员,有没有办法只在仪表板中显示它?我需要一些类似的东西,但它不起作用:
global $current_user;
global $showui;
if($current_user->roles[0] == 'administrator') {
$showui = true;
}
else {
$showui = false;
}
//Custom Industry Taxonomy Code (For Projects CPT)
register_taxonomy('servicecategory',
array ( 0 => 'servicecategory',),
array( 'hierarchical' => true,
'label' => 'Specialties',
'show_ui' => $showui,
'query_var' => true,
'rewrite' => true,
'show_in_nav_menus' => true,
'show_admin_column' => true,
'singular_label' => 'Menu'
)
);