Created
May 30, 2021 02:46
-
-
Save ofernandolopes/e3b7ae6583d6ad77b55b61729a8ae103 to your computer and use it in GitHub Desktop.
Removing wp admin bar nodes for non admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Removing wp admin bar nodes for non admin | |
function wpdocs_remove_nodes($wp_admin_bar) | |
{ | |
// Remove items from the menu bar. | |
if ( ! current_user_can('administrator')) { | |
$wp_admin_bar->remove_node('wp-logo'); | |
$wp_admin_bar->remove_node('comments'); | |
$wp_admin_bar->remove_node('new-content'); | |
$wp_admin_bar->remove_node('edit'); | |
$wp_admin_bar->remove_node('litespeed-menu'); | |
$wp_admin_bar->remove_node('theme-dashboard'); | |
$wp_admin_bar->remove_node('customize'); | |
$wp_admin_bar->remove_node('new_draft'); | |
$wp_admin_bar->remove_node('updates'); | |
} | |
} | |
add_action('admin_bar_menu', 'wpdocs_remove_nodes', 999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment