Custom Role does not have access to dashboard

I was just adding a custom role by using the add_role() function. Here is the code below:

add_role('user', 'User', array('read'));

I figured this would give the same level of access as the subscribers role. Technically I want them to be the same but I don’t want to use the subscribers as a role for certain users because there will be different access between the two.

However, although, from what I read on the wordpress codex site, the subscribers has only one capability and that is to ‘read’ it has access to the dashboard and can edit their own profile. My custom role cannot. I get the following message when going to the admin panel.

You do not have sufficient permissions to access this page.

Why is that? Hoe do get the right permissions to do this?

Thanks,
Joe

1
1

You have to give the capability a true or false, like this:

add_role('user', 'User', array( 'read' => true ));

To fix it, first remove the role and than re-add it again.

remove_role('user');
add_role('user', 'User', array('read' => true));

http://codex.wordpress.org/Function_Reference/add_role

Leave a Comment