WP: Remove Unwanted Admin Menu Items

<?php /*-----------------------------------------------------------------------------------*/ /* More info here: http://camwebdesign.com/techniques/simplify-the-wordpress-admin-sidebar-navigation/ */ /*-----------------------------------------------------------------------------------*/ function remove_admin_menu_items() { $remove_menu_items = array(__('Posts'), __('Media'), __('Comments')); global $menu; end($menu); while (prev($menu)) { $item = explode(' ', $menu[key($menu)][0]); if (in_array($item[0] != NULL ? $item[0] : "", $remove_menu_items)) { unset($menu[key($menu)]); } } } add_action('admin_menu', 'remove_admin_menu_items');
Simple snippet to remove items from the admin. The main bit is the following:

$remove_menu_items = array(__('Posts'), __('Media'), __('Comments'));

Items available for removal: Media, Pages, Appearance, Plugins, Users, Tools and Settings.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.