Role Worksheet

//Update user role
$u = new WP_User( 26 );
$u->remove_role( 'editor' );
$u->add_role( 'customrole' );

//Add new custom role
add_role('customrole', 'Customrole',array('read' => 1,'level_0' => 1,'access_level_0' => 1,'access_level_1' => 1));

//Remove Role
remove_role('customrole');

//Add capability
global $wp_roles;
$wp_roles->add_cap('customrole','access_level_1');

0 Comments

You must be logged in to post a comment.