Skip to content

Instantly share code, notes, and snippets.

@roose
Created February 28, 2012 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roose/1933047 to your computer and use it in GitHub Desktop.
Save roose/1933047 to your computer and use it in GitHub Desktop.
Remove menu in Wordpress admin menu
<?php
function remove_menus () {
global $menu;
$restricted = array(__('Links'), __('Posts'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
}
add_action('admin_menu', 'remove_menus');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment