how to restrict pages to a specified users based on their roles in wordpress

admin

Administrator
Staff member
I am new to wordpress and I have a website that includes some roles different of the based roles of the wordpress (administrator , author, contributor...)

I have created roles as chef_dept, employee that have these capabilities:

Code:
add_role('Chef_Dept', __(
    'Chef_Dept'),
     array(
        'read'              => true, // Allows a user to read
        'create_posts'      => true, // Allows user to create new posts
        'edit_posts'        => true, // Allows user to edit their own posts
        'edit_others_posts' => true, // Allows user to edit others posts too
        'publish_posts'     => true, // Allows the user to publish posts
        'manage_categories' => true, // Allows user to manage post categories
        'upload_files'      => true, //  Allows user to upload file 
    )
);

add_role('employee ', __(
   'employee '),
    array(
        'read'              => true, // Allows a user to read
        'create_posts'      => true, // Allows user to create new posts
        'publish_posts'     => true, // Allows the user to publish posts
        'manage_categories' => true, // Allows user to manage post categories
    )
);


add_role( $role, $display_name, $capabilities );

and I need to restrict all users that have role employee to not enter to some pages, is this possible?

i am using the the <strong>Restrict Page By Role</strong> plugin but seems its not working because user that have <strong>employee</strong> role are able to upload file and enter to the restricted pages