Is there a way to completely remove (unset) the left hand side admin menu? I examined the ozh-admin-drop-down-menu plugin, since it removes the entire admin menu and adds a top menu bar in order to get a clue.. I made a few snippets, but probably I am missing sth.. I couldn't manage to find a way out..
2 Answers
I don't think you can remove it globally, maybe with traversing the global $menu
array.
But you can unset each individually:
add_action( 'admin_menu', 'Wps_remove_tools', 99 );
function Wps_remove_tools(){
remove_menu_page( 'index.php' ); //dashboard
remove_menu_page( 'edit.php' ); //posts
remove_menu_page( 'upload.php' ); //media
remove_menu_page( 'link-manager.php' ); //links
remove_menu_page( 'edit.php?post_type=page' ); //page
remove_menu_page( 'edit-comments.php' ); //comments
remove_menu_page( 'themes.php' ); //appearance
remove_menu_page( 'plugins.php' ); //plugins
remove_menu_page( 'users.php' ); //users
remove_menu_page( 'tools.php' ); //tools
remove_menu_page( 'options-general.php' ); //settings
}
-
Thank you.. but this removes only the menu items and leaves an empty gray bar..– ugurcemCommented Dec 8, 2011 at 19:58
-
You can just hide it with css then....
#adminmenuwrap{display:none;}
– WyckCommented Dec 8, 2011 at 20:41 -
ok, that was the last option.. :) together with #adminmenuback{display:none;} and #wpcontent {margin-left: 15px;}, the admin bar is being removed visually and the remaining part of the page spans the area emptied by the admin bar. As far as I can understand there is no way to stop construction of the original menu.. Thank you for the ideas Wyck :)– ugurcemCommented Dec 9, 2011 at 21:23
Just to explain the solution better:
I made below additions to theme's function.php in order to remove visually (hide) left hand admin menu:
add_action('admin_init', 'add_custom_admin_style');
function add_custom_admin_style(){
wp_register_style('custom_admin_style', content_url('themes').'/custom_admin.css');
wp_enqueue_style('custom_admin_style');
}
And then I created custom_admin.css file in themes folder and put below lines:
#adminmenuwrap, #adminmenuback {display:none;}
#wpcontent, #footer {margin-left: 15px;}