Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Thanks Rob. Sorry I actually did set the capability to true on my second attempt at trying to resolve the issue. I just edited it a few times and went back to how I had it before. I guess because I screwed up the first time I had to remove the role and re-add it for it to register. Before when I changed 'real' => true, I guess it wasn't saving because the role was already created as array('real') from a previous attempt. –  JoeMoe1984 May 9 '13 at 16:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.