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?