Paulund
2012-01-15 #wordpress

Remove Links From Wordpress Admin Menu

Since Wordpress 3.1 they have made it very easy to remove any unwanted links from the admin menu bar.

Most people don't want the Links menu item to be displayed so by adding the following code to your functions.php page you can remove the links menu item.


add_action( 'admin_menu', 'my_admin_menu' );
 
function my_admin_menu() {
     remove_menu_page('link-manager.php');
}

If you want to remove any of the others then make sure that you change link-manager.php page to one of the other pages. For example if you want to remove the media link from the menu then change the above snippet to.


add_action( 'admin_menu', 'my_admin_menu' );
 
function my_admin_menu() {
     remove_menu_page('upload.php');
}

Remove Sub Menu Pages

To remove a sub-menu page you can not use the remove_menu_page() function, this will not work. If you want to remove a sub-menu page you need to use the function remove_submenu_page(). You use this the same way as the remove_menu_page() but you pass through the slug of the sub-menu.


<?php remove_submenu_page( $menu_slug, $submenu_slug ) ?>