Created
March 6, 2014 20:34
-
-
Save aaronjorbin/9399084 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
<?php | |
/* | |
Plugin name: LaFours | |
Description: Removes caps for actions that should take place in code, not in UI | |
Author: Aaron Jorbin | |
Author URI: http://aaron.jorb.in/ | |
Version: 0.1 | |
*/ | |
function lafours_map_meta_cap($caps, $cap, $user_id, $args) { | |
// This is LaFours White Straw Cap | |
$not_allow = array( | |
'update_plugins', | |
'delete_plugins', | |
'install_plugins', | |
'activate_plugins', | |
'edit_plugins', | |
'update_themes', | |
'delete_themes', | |
'install_themes', | |
'edit_themes', | |
'switch_themes', | |
'edit_theme_options', | |
'manage_options', | |
'update_core', | |
'edit_files', | |
); | |
if( in_array($cap, $not_allow) ) { | |
$caps = array(); | |
$caps[] = 'do_not_allow'; | |
} | |
return $caps; | |
} | |
add_filter('map_meta_cap', 'lafours_map_meta_cap', 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment