Skip to content

Instantly share code, notes, and snippets.

@denishvachhani
Last active December 20, 2015 08:49
Show Gist options
  • Save denishvachhani/6103747 to your computer and use it in GitHub Desktop.
Save denishvachhani/6103747 to your computer and use it in GitHub Desktop.
Hide Admin Menus
<?php
add_action('admin_menu', 'remove_menu_items');
if( !function_exists('remove_menu_items') ) :
/**
*
*/
function remove_menu_items() {
global $menu;
$restricted = array(__('Links'), __('Comments'),
__('Plugins'), __('Portfolios'), __('Albums'), __('News'), __('Tools'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){
unset($menu[key($menu)]);}
}
}
endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment