Sean Clarke
asked on
wordpress add_cap not working
I'm trying to clone a user role in WordPress to give an editor role slightly more ability.
The following line causes the white screen of death:
Can anyone help to add this simple additional capability?
Full function listed below for reference.
The following line causes the white screen of death:
$role_owner->add_cap('edit_theme_options');
Can anyone help to add this simple additional capability?
Full function listed below for reference.
add_action('init', 'createUserRole');
function createUserRole()
{
global $wp_roles;
if (!isset($wp_roles))
$wp_roles = new WP_Roles();
$role_editor = $wp_roles->get_role('editor');
$role_owner = $wp_roles->add_role('owner', 'Site Owner', $role_editor->capabilities);
$role_owner->add_cap('edit_theme_options');
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.