Last active
December 15, 2015 06:09
-
-
Save raphaelchaib/5213791 to your computer and use it in GitHub Desktop.
Wordpress: Remove admin's menu options for end-user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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