WordPress – Custom user role – grant guest access to edit.php without insert/update/delete

Solution:

I have figured it out, I was only creating a role, but I didn’t add any capabilities to it. The code I was missing will be like and its working now:

function add_capability() {
    // gets the author role
    $role = get_role( 'guest' );
    // This only works, because it accesses the class instance.
    $role->add_cap( 'edit_others_posts' ); 
    $role->add_cap( 'read_post' ); 
    $role->add_cap( 'edit_posts' ); 
}
add_action( 'admin_init', 'add_capability');