user capabilities restricted to access specific pages only in wordpress


Staff member
i want to create a user in wordpress that will have access to only few pages in wordpress and nothing else, this user can edit , delete ,update and crreate any thing or cutomize the pages allowed to him only having no access to any other things in wordpress for that i have tried many plugins like :
UAM User Access manager
press permit Core
Role scoper
but they are not according to my needs or may be i am not using them well . any help in that will be appreciated . i have also tried to create user through code from the backend but was not able to complete it correctly please provide any relevent help as early as possible :
i have created role through this :

$result = add_role(
    __( 'Basic Contributor' ),
        'read'         => true,  // true allows this capability
        'edit_posts'   => true,
        'delete_posts' => false, // Use false to explicitly deny
if ( null !== $result ) {
    echo 'Yay! New role created!';
else {
    echo 'Oh... the basic_contributor role already exists.';


function add_roles_on_plugin_activation() {
       add_role( 'custom_role', 'Custom Subscriber', array( 'read' => true, 'level_0' => true ) );
   register_activation_hook( __FILE__, 'add_roles_on_plugin_activation' );

but it didn't helped me much ..