Skip to content

Instantly share code, notes, and snippets.

@jmahony
Created May 31, 2013 16:16
Show Gist options
  • Save jmahony/5686087 to your computer and use it in GitHub Desktop.
Save jmahony/5686087 to your computer and use it in GitHub Desktop.
WordPress: delete unwanted capabilities
<?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