Skip to content

Instantly share code, notes, and snippets.

@dbernar1
Created August 28, 2013 16:31
Show Gist options
  • Save dbernar1/6368069 to your computer and use it in GitHub Desktop.
Save dbernar1/6368069 to your computer and use it in GitHub Desktop.
Resetting capabilities for admin role in WordPress to the defaults, programmatically. I ran this through functions.php of the theme. List of caps copied from http://codex.wordpress.org/Roles_and_Capabilities#Administrator
<?php
$administrator = get_role( 'administrator' );
foreach (
array( 'activate_plugins', 'delete_others_pages', 'delete_others_posts', 'delete_pages', 'delete_plugins', 'delete_posts', 'delete_private_pages', 'delete_private_posts', 'delete_published_pages', 'delete_published_posts', 'edit_dashboard', 'edit_files', 'edit_others_pages', 'edit_others_posts', 'edit_pages', 'edit_posts', 'edit_private_pages', 'edit_private_posts', 'edit_published_pages', 'edit_published_posts', 'edit_theme_options', 'export', 'import', 'list_users', 'manage_categories', 'manage_links', 'manage_options', 'moderate_comments', 'promote_users', 'publish_pages', 'publish_posts', 'read_private_pages', 'read_private_posts', 'read', 'remove_users', 'switch_themes', 'upload_files', 'create_product', )
as $cap
) {
$administrator->add_cap( $cap );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment