Last active
June 14, 2022 17:33
-
-
Save ofernandolopes/c0dead0e574bec0be2913699518edcc3 to your computer and use it in GitHub Desktop.
Removing links from the WordPress Toolbar
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 links from the WordPress Toolbar | |
function webriti_remove_admin_bar_links() { | |
global $wp_admin_bar; | |
//Remove WordPress Logo Menu Items | |
$wp_admin_bar->remove_menu('wp-logo'); // Removes WP Logo and submenus completely, to remove individual items, use the below mentioned codes | |
$wp_admin_bar->remove_menu('about'); // 'About WordPress' | |
$wp_admin_bar->remove_menu('wporg'); // 'WordPress.org' | |
$wp_admin_bar->remove_menu('documentation'); // 'Documentation' | |
$wp_admin_bar->remove_menu('support-forums'); // 'Support Forums' | |
$wp_admin_bar->remove_menu('feedback'); // 'Feedback' | |
//Remove Site Name Items | |
$wp_admin_bar->remove_menu('site-name'); // Removes Site Name and submenus completely, To remove individual items, use the below mentioned codes | |
$wp_admin_bar->remove_menu('view-site'); // 'Visit Site' | |
$wp_admin_bar->remove_menu('dashboard'); // 'Dashboard' | |
$wp_admin_bar->remove_menu('themes'); // 'Themes' | |
$wp_admin_bar->remove_menu('widgets'); // 'Widgets' | |
$wp_admin_bar->remove_menu('menus'); // 'Menus' | |
// Remove Comments Bubble | |
$wp_admin_bar->remove_menu('comments'); | |
//Remove Update Link if theme/plugin/core updates are available | |
$wp_admin_bar->remove_menu('updates'); | |
//Remove '+ New' Menu Items | |
$wp_admin_bar->remove_menu('new-content'); // Removes '+ New' and submenus completely, to remove individual items, use the below mentioned codes | |
$wp_admin_bar->remove_menu('new-post'); // 'Post' Link | |
$wp_admin_bar->remove_menu('new-media'); // 'Media' Link | |
$wp_admin_bar->remove_menu('new-link'); // 'Link' Link | |
$wp_admin_bar->remove_menu('new-page'); // 'Page' Link | |
$wp_admin_bar->remove_menu('new-user'); // 'User' Link | |
// Remove 'Howdy, username' Menu Items | |
$wp_admin_bar->remove_menu('my-account'); // Removes 'Howdy, username' and Menu Items | |
$wp_admin_bar->remove_menu('user-actions'); // Removes Submenu Items Only | |
$wp_admin_bar->remove_menu('user-info'); // 'username' | |
$wp_admin_bar->remove_menu('edit-profile'); // 'Edit My Profile' | |
$wp_admin_bar->remove_menu('logout'); // 'Log Out' | |
} | |
add_action( 'wp_before_admin_bar_render', 'webriti_remove_admin_bar_links' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment