Remove menu items from WordPress admin bar
Remove menu items from WordPress admin bar
Here is a super useful code snippet for developers who wants to prevent their clients to access some dashboard menus, such as “Plugins” or “Settings”. Paste this code into your theme functions.php file to remove menus from the admin bar.
function wps_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu(‘wp-logo’);
$wp_admin_bar->remove_menu(‘about’);
$wp_admin_bar->remove_menu(‘wporg’);
$wp_admin_bar->remove_menu(‘documentation’);
$wp_admin_bar->remove_menu(‘support-forums’);
$wp_admin_bar->remove_menu(‘feedback’);
$wp_admin_bar->remove_menu(‘view-site’);
}
add_action( ‘wp_before_admin_bar_render’, ‘wps_admin_bar’ );