Last active
August 29, 2015 14:19
-
-
Save robgolbeck/e345ca23d8e6de727051 to your computer and use it in GitHub Desktop.
WordPress Custom User Role
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 | |
// Assign custom permissions for specific user roles | |
// This example gives Editors access to Menus and Theme Options: | |
add_action( 'admin_menu', 'edit_admin_menus' ); | |
// Allow editors to manage theme options (under Appearance) | |
$role_object = get_role( 'editor' ); | |
$role_object->add_cap( 'edit_theme_options' ); | |
// Now hide all options except Menus & Customise | |
function hide_menu() { | |
remove_submenu_page( 'themes.php', 'themes.php' ); // hide the theme selection submenu | |
remove_submenu_page( 'themes.php', 'widgets.php' ); // hide the widgets submenu | |
} | |
add_action('admin_head', 'hide_menu'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment