Created
May 31, 2013 16:16
-
-
Save jmahony/5686087 to your computer and use it in GitHub Desktop.
WordPress: delete unwanted capabilities
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 | |
// Function to delete capabilities | |
// http://chrisburbridge.com/delete-unwanted-wordpress-custom-capabilities/ | |
add_action( 'admin_init', 'clean_unwanted_caps' ); | |
function clean_unwanted_caps() { | |
global $wp_roles; | |
$delete_caps = array( | |
'capability1' | |
); | |
foreach ($delete_caps as $cap) { | |
foreach (array_keys($wp_roles->roles) as $role) { | |
$wp_roles->remove_cap($role, $cap); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment