Skip to content

Instantly share code, notes, and snippets.

@kaseybon
Created August 28, 2014 13:53
Show Gist options
  • Save kaseybon/285da9639e10e7dd304e to your computer and use it in GitHub Desktop.
Save kaseybon/285da9639e10e7dd304e to your computer and use it in GitHub Desktop.
WordPress - Hides menu options in the WordPress backend.
// Hide unused sections in the backend
function remove_menus () {
global $menu;
$restricted = array( __('Posts'), __('Links'), __('Comments'), __('Plugins') );
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