Note: This addon requires an Uncanny Automator Business or Agency license.
Once you have created access levels for using the Restrict Content addon, one way to restrict content in the front end is by controlling the output of Gutenberg blocks based on role, access level or custom field.
Restrict Block content
When the Restrict Content plugin is active, it adds a new icon to blocks and to the block editor itself, like this:
When that icon is clicked, it adds a new sidebar to the block editor that can be used to control who can see the block in the front end. Here’s a partial example of what you will see in the Restrict Block Access sidebar:
Using this control panel, you can restrict access to the contents of the block based on the following:
- Whether or not the user is logged in
- Access level
- Custom user fields (if the Custom User Fields plugin is active)
If the user viewing the page meets the criteria, they will see the block and its contents. If they don’t meet the criteria:
- The message in the “Restrict Content Message” field will be output inside the block if a message is populated. This message area can include HTML and shortcodes.
- If the message area is blank, the block will not be output at all. Users would not even know that a block exists.
Note: Administrators always see blocks in the front end, even if they don’t meet the criteria.