The code below removes everything I want except for the comments dropdown.
That pesky little icon just won’t go away. Is there another method?
// Remove Admin bar links
function remove_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo'); // Remove the WordPress logo
$wp_admin_bar->remove_menu('about'); // Remove the about WordPress link
$wp_admin_bar->remove_menu('wporg'); // Remove the WordPress.org link
$wp_admin_bar->remove_menu('documentation'); // Remove the WordPress documentation link
$wp_admin_bar->remove_menu('support-forums'); // Remove the support forums link
$wp_admin_bar->remove_menu('feedback'); // Remove the feedback link
$wp_admin_bar->remove_menu('comments'); // Remove the comments link
$wp_admin_bar->remove_menu('new-content'); // Remove the content link
}
add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
2
Answers
Figured out I have to add:
$wp_admin_bar->remove_menu('notes');
That gets rid of the comments icon.
You can use:
Note that you can use
$wp_admin_bar->get_nodes()
to get available nodes.