So, I am trying to create several user roles in my theme to fit the user requirements of the site.
The first and simplest, which is an "external viewer", which I just want to be able to view the messages (both built-in and custom post-types) that someone from the content team created and planned at some point in the future.
I tried this first
$viewer_capabilities = array( 'read_private_pages' => true, 'read_private_posts' => true, 'read' => true ); add_role('external_viewer', 'External Viewer', $viewer_capabilities );
But when I logged in to /wp-admin I received a message "without permission", and I could not do anything. If I went to one of the planned posts, I just got "not found".
So 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 took me a little further. I can log in and see the admin control panel, but if I visit a scheduled message, I still get a "page not found".
Can anyone see what I am missing?
source share