How can i remove the whole menu in the admin?
I have this code:
function remove_menu_items() {
global $menu;
end( $menu );
while ( prev($menu) ) {
$value = explode( ' ', $menu[ key($menu) ][0] );
if ( $value[0] != NULL ? $value[0] : "" ) {
unset( $menu[ key($menu) ] );
}
}
}
add_action( 'admin_menu', 'remove_menu_items' );
This only removes the default menu items, any pages added to the menu by a plugin are still there.
How can i remove the whole menu?
3 Answers
add_action('admin_head', 't5_hide_menu');
function t5_hide_menu()
{
$GLOBALS['menu'] = array();
?>
<style>#adminmenuback,#adminmenuwrap{display:none !important}
#wpcontent, #footer{margin-left:0 !important}</style>
<?php
}
Now I want to know: why? 🙂