The User Role control allows you to conditionally show or hide blocks based on the “role” of the user viewing the webpage. This control can be extremely useful for showing specific content to logged-in users, customer, members, etc.
How to Use
Click on any block in the Block Editor and navigate to the Visibility panel. You will notice the User Role control located beneath the Date & Time control. See the screenshot below. This control is enabled be default for all blocks, but can be easily disabled by clicking on the ellipsis icon and deselecting “User Role”.
User Role control allows you to control who can see the block. There are four options:
When a block is set to Public, the block will be visible to everyone. This is the default option.
When a block is set to Logged-out, only website visitors that are not logged into your website will see the block.
When a block is set to Logged-in, only website visitors that are logged into your website will see the block. This setting does not care about the user’s specific user role (Administrator, Subscriber, Customer…), they just need to be logged in.
The User Role setting allows you to fine-tune the visibility of the block. When enabled, you will be able to select the individual user roles that should be able to see the block. For example, in the screenshot above, the block is only visible to administrators and authors on the website.
The list of available roles includes the standard user roles that come with WordPress, as well as any additional roles provided by third-party plugins or themes.
Hide on Selected Roles
When the User Roles option is enabled, you will also see a toggle for “Hide on Selected Roles”. By default, if specific user roles are selected, the block will only display to users of those selected roles. For example if
Author are selected, the block will only be visible to administrators and authors.
But what if you wanted to display the block to everyone except administrators and authors? That is where “Hide on Selected Roles” comes in. Simply toggle that setting and now the block will only be visible to users without the selected roles.
How to Disable
If you would like to disable the User Role control at the block level, simply click on the ellipsis icon in the “Controls” bar and deselect it. That said, if you don’t think you will need this control on your website at all, it can be disabled globally in the Visibility Control Settings.
Note that if this control is disabled globally, any blocks that are actively being hidden by the User Role control will become visible again.