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.

So, I'm trying to create a number of custom roles within my theme to meet with the custom requirements of the site.

The first, and most simple, being 'external viewer' who I want to simply be able to view posts (both built in and custom post-types) that someone else on the content team has created and scheduled for some point in the future.

Initially I tried this

$viewer_capabilities = array(
    'read_private_pages' => true,
    'read_private_posts' => true,
    'read' => true
);


add_role('external_viewer', 'External Viewer', $viewer_capabilities );

But when logging into /wp-admin I just got the 'no permission' message and I couldn't do anything. If I went to one of the scheduled posts, I just got 'not found'.

So then I tried

$role_object = get_role( 'external_viewer' );
$role_object->add_cap( 'read_private_pages' );
$role_object->add_cap( 'read_private_posts' );
$role_object->add_cap( 'read' );

Which got me a little further. I can login and see the admin dashboard, but if I visit a scheduled post, then I still get 'page not found'.

Can anyone see what I'm missing?

share|improve this question
add comment

1 Answer

I found Future posts are not exactly a different capability.

In WordPress Roles and Capabilities I found edit_others_posts is available by default for Super Admin, Administrator and Editor. I think it will be a right way you can proceed. (Not tested though)

And additionally try with edit_published_posts, publish_posts etc.

share|improve this answer
add comment

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.