database - WordPress - Custom user role - grant guest access to edit.php without insert/update/delete
I am working on a site where I want to show customers a demo-version of a product. To do this they can login with a guest-account, I have created this role as follows
add_role('guest', __('Guest'), array('read'=> true));
When I login as a guest I get redirected to and get to see the
overview-page /admin.php?page=my_overview, so this does work, but when the guest clicks on any item in this overview I get a message saying: You don't have permission to access this page.
These items refer to pages like:
/profile.php /edit.php /users.php /admin.php
Since using these pages is a basic part of my products functionality, I want to grant the guest account access to these pages, but don't let them insert/update/delete any data which is shown on those pages.
I have tried adding multiple different privileges
i.e. edit_posts, edit_private_posts, edit_private_pages, read_private_posts, read_private_pages but I can't get it to work right.
I would like to achieve this guest account with specific permissions without the use of any plugin. Basically I want to create a user that can do the same as an Author, but without any
INSERTs/UPDATEs/DELETEs on my demo-site to the database
I don't know if it is even possible, but any help would be appreciated.
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: