I have a user role called Student and would like to allow them access to Private pages (currently only admin and editor roles can do this). I would like to create a function to do so. I found a post that said to add this to the functions.php in my child theme:

// Allow Students to see Private posts and pages  
$subRole = get_role( 'Student' );   
$subRole->add_cap( 'read_private_posts' );  
$subRole->add_cap( 'read_private_pages' );

But it doesn’t seem to do anything. Is there a way to change the ability to access private pages?

Also above it says ‘read_private_pages’ I want to be sure that they can submit the form on that page as well (not just read the page).

Read more here: Change WordPress User Roles with access to Private Pages


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: