Skip to content

Instantly share code, notes, and snippets.

@fleeting
Created May 23, 2013 15:28
Show Gist options
  • Save fleeting/5636928 to your computer and use it in GitHub Desktop.
Save fleeting/5636928 to your computer and use it in GitHub Desktop.
WordPress - Remove Posts menu item in admin area.
/*-----------------------------------------------------------------------------------*/
/* Remove Unwanted Admin Menu Items */
/*-----------------------------------------------------------------------------------*/
function remove_admin_menu_items() {
$remove_menu_items = array(__('Posts'));
global $menu;
end ($menu);
while (prev($menu)){
$item = explode(' ',$menu[key($menu)][0]);
if(in_array($item[0] != NULL?$item[0]:"" , $remove_menu_items)){
unset($menu[key($menu)]);}
}
}
add_action('admin_menu', 'remove_admin_menu_items');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment