Created
February 26, 2019 18:27
-
-
Save fillipetech/16737feb07665dbd34ae333492cce497 to your computer and use it in GitHub Desktop.
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
| // Run the function on admin_init | |
| add_action('admin_init', 'remove_profile_menu'); | |
| // Removal function | |
| function remove_profile_menu() { | |
| global $wp_roles; | |
| // Remove the menu. Syntax is `remove_submenu_page($menu_slug, $submenu_slug)` | |
| remove_submenu_page('users.php', 'profile.php'); | |
| /* Remove the capability altogether. Syntax is `remove_cap($role, $capability)` | |
| * 'Read' is the only capability subscriber has by default, and allows access | |
| * to the Dashboard and Profile page. You can also remove from a specific user | |
| * like this: | |
| * $user = new WP_User(null, $username); | |
| * $user->remove_cap($capability); | |
| */ | |
| $wp_roles->remove_cap('subscriber', 'read'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment