Last active
March 1, 2019 10:52
-
-
Save kisildev/f189382af27e433d77fb5bf2449ab6b1 to your computer and use it in GitHub Desktop.
Remove & Restore Wp Plugins
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
| /******************* HIDE/SHOW WORDPRESS PLUGINS MENU ITEM *********************/ | |
| /** | |
| * Remove and Restore ability to Add new plugins to site | |
| */ | |
| function remove_plugins_menu_item($role_name){ | |
| $role = get_role( $role_name ); | |
| $role->remove_cap( 'activate_plugins' ); | |
| $role->remove_cap( 'install_plugins' ); | |
| $role->remove_cap( 'upload_plugins' ); | |
| $role->remove_cap( 'update_plugins' ); | |
| } | |
| function restore_plugins_menu_item($role_name){ | |
| $role = get_role( $role_name ); | |
| $role->add_cap( 'activate_plugins' ); | |
| $role->add_cap( 'install_plugins' ); | |
| $role->add_cap( 'upload_plugins' ); | |
| $role->add_cap( 'update_plugins' ); | |
| } | |
| // remove_plugins_menu_item('administrator'); | |
| restore_plugins_menu_item('administrator'); | |
| /*******************************************************************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment