Remove Items from admin bar for authors

// Remove Items from admin bar for authors
function remove_admin_bar_links() {
 if (current_user_can('author')){
	global $wp_admin_bar;
	$wp_admin_bar->remove_menu('new-content'); // Remove Add New
	$wp_admin_bar->remove_menu('comments'); // Remove Comments
	$wp_admin_bar->remove_menu('wpseo-menu'); // Remove Yoast SEO links menu
	$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
 }
}
add_action('wp_before_admin_bar_render', 'remove_admin_bar_links');

Source: 10+ Useful WordPress Code Snippets

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.