Access allows you to limit the front-end (read) access to specific pages, posts or custom types. You can define who can access the full content and what others, without full access, see.
A post group is a set of read access settings, shared by a group of content entries. A group of content entries may contain as little as one post or any number of posts.
When you edit a page or a post, you will see the Post group metabox in the WordPress Block Editor’s right sidebar, under the Document tab.
When you first use this feature, your site will have no post groups. Click on the button to change post group and create a new one. Then, you can add other posts to that group or create new groups.
Please note that since the Access version 2.3.2, it is not possible to add items belonging to the Media (attachments) post type, to the Post groups.
The Access plugin allows you to specify two new capabilities for your custom user roles:
- allow user role to select post groups for their contents
- allow user role to create new post groups for the contents
For example, this can be useful in situations where you might want to allow particular users to select groups for posts, but you do not want them to be able to create new groups.
If you have WPML installed the Access plugin will also allow you to create WPML groups and select read permissions based on the language.
You can create WPML groups and edit the existing ones from the WPML Groups tab on the Toolset -> Access Control page.
Click to create a new WPML group and then select the post type and the language you want to use.
If a post belongs to a post group, you can edit the read permissions to it.
When editing a post, click the Edit GROUP_NAME group privileges link (GROUP_NAME is the name of the actual group you have created). This takes you to the Access Control screen, pointing at the tab for post groups.
The group editing options allow you to set read, edit, and delete permissions for each role in your website. However, only administrators are able to change the edit and delete permissions for Post Groups.
If a certain user type has edit permission for at least one post, the post listing page in the admin will be visible to that user. For example, if a user can edit even one Book custom post, they will also have access to the admin page listing all the Book posts.
Administrators are also able to allow user roles to edit all posts belonging to a certain post type except the ones that belong to a certain Post Group.
There are two specific places where you can choose what to display for people without read permission, as shown in the following table.
|Editing the global option for all user roles||Editing the option for specific user role|
When you uncheck the read permission, you can choose what to output instead of the content.
You can select from the following options:
- Default error, the one selected for all user roles.
- A 404 page, indicating that this content doesn’t exist.
- The current page rendered using a template layout or, in case you are not using Layouts, a Content Template.
The third option allows you to display teasers for the content or any other text that you choose. Simply select a template layout you wish to render, usually, you will want to create a layout specific for this use. You can use it to display your sign-up messages or any other information which indicates to the reader that they need to log in or buy something from you to gain access.
In the dialog box for selecting what users without permission see, there is a Preview error for GROUP_NAME link. Clicking it displays a page belonging to the Post group, and automatically “simulates” the selected user role and a post belonging to the related post type.
Please note that the preview only works for administrators. Additionally, the related post type needs to have at least one existing post.