Change WordPress user roles and capabilities › Forums › Bug Reports › Wp Bakery Page Builder › Reply To: Wp Bakery Page Builder
22/06/2018 at 08:24
#4963
Vladimir
Keymaster
This code snippet will exclude “WP Bakery Page Builder” welcome page menu item from the left side admin menu for the current user with ‘author’ role:
add_action('admin_menu', 'hide_vc_welcome', 100);
function hide_vc_welcome() {
global $menu;
$user = wp_get_current_user();
if (empty($user)) {
return;
}
if (!is_array($user->roles) || !in_array('author', $user->roles)) {
return;
}
foreach($menu as $key=>$item) {
if ($item[2]=='vc-welcome') {
unset($menu[$key]);
break;
}
}
}