Skip to content

Instantly share code, notes, and snippets.

@felixzapata
Created February 21, 2014 22:32
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save felixzapata/9144986 to your computer and use it in GitHub Desktop.
Save felixzapata/9144986 to your computer and use it in GitHub Desktop.
How to create a clone role in WordPress
<?php
add_action('init', 'cloneRole');
function cloneRole()
{
global $wp_roles;
if ( ! isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$adm = $wp_roles->get_role('administrator');
//Adding a 'new_role' with all admin caps
$wp_roles->add_role('new_role', 'My Custom Role', $adm->capabilities);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment