Created
April 20, 2016 08:30
-
-
Save crewstyle/49a327e01bee6bce3592780dfb4b88e4 to your computer and use it in GitHub Desktop.
WordPress ~ Remove dashboard menus to editor role - #backend #security
This file contains hidden or 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 dashboard menus to editor role. | |
* | |
* @uses current_user_can() To know if current user has permissions. | |
* @uses remove_menu_page() To remove a menu page. | |
* @uses remove_submenu_page() To remove a submenu page. | |
* @see https://github.com/crewstyle/clean-wordpress | |
*/ | |
add_action('admin_menu', '_cw_remove_menus_for_all'); | |
function _cw_remove_menus_for_all() | |
{ | |
//Remove WORDPRESS pages in the administration to all users, except the admin | |
if (!current_user_can('edit_users')) { | |
remove_submenu_page('themes.php', 'themes.php'); | |
remove_menu_page('plugins.php'); | |
remove_submenu_page('index.php', 'update-core.php'); | |
remove_submenu_page('options-general.php', 'options-media.php'); | |
remove_menu_page('link-manager.php'); | |
remove_menu_page('tools.php'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment