Skip to content

Instantly share code, notes, and snippets.

@raphaelchaib
Last active December 15, 2015 06:09
Show Gist options
  • Save raphaelchaib/5213791 to your computer and use it in GitHub Desktop.
Save raphaelchaib/5213791 to your computer and use it in GitHub Desktop.
Wordpress: Remove admin's menu options for end-user
<?php
// Remove admin's menu options
add_action('admin_menu', 'remove_menu_options');
function remove_menu_options () {
global $menu;
$remove = array(__('Links'), __('Posts'), __('Comments'), /*__('Dashboard'),*/ __('Tools'), /*__('Appearance'),*/ __('Plugins'), __('Users'), __('Settings'));
end($menu);
while(prev($menu)){
$value = explode(' ', $menu[key($menu)][0]);
if(in_array($value[0] != NULL ? $value[0] : "" , $remove)) {
unset($menu[key($menu)]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment