Restrict Access & Visibility of Contents in WordPress Block Editor

Many web developers and site builders are building more websites using WordPress’s “Gutenberg” block editor, which also powers the post and page writing experience.

Suppose you want to control the visibility and restrict access to specific contents, elements, sections and widgets when previewed on the front end of your site based on your users’ logged-in status, roles and membership plans. In that case, this article is for you.

You will learn how to restrict visibility

Using Conditional Blocks Plugin

We will be relying on the powerful Conditional Blocks plugin to achieve this. Ensure you have the plugin installed and activated on your site.

To restrict content visibility in the WordPress block editor, click on the content to reveal the block setting, scroll to the “Visibility Conditions” section and click the “Configure Conditions” button.

Select “Active Membership Plan” under ProfilePress as the Condition, and then the membership plans whose active subscribers the block will be shown to or hidden from (based on the Block Action).

Don’t forget to save your changes when done.

The plugin also allows you to restrict content in the block editor based on user role, logged-in status, device type and more.

Using Block Visibility Plugin

Prerequisite

We will be relying on the powerful Block Visibility plugin to achieve this. Ensure you have the Block Visibility plugin installed and activated on your site.

Also, ensure a user role is associated with your membership plans. This is important if you want to restrict content by membership plans.

Content Restriction

To restrict content visibility in the WordPress block editor, click on the content to reveal the block setting and scroll to the “Visibility” section.

Select the user role associated with the plans to restrict the content to users or customers of specific membership plans. For example, in the image above, we selected the role “Standard” associated with a Standard membership plan.

Only the selected user roles can access or see the content by default. If you would rather hide the content to the selected user role, enable the “Hide from selected roles”.

Don’t forget to save your changes when done.

See also: WordPress Navigation Menu Restriction & Visibility Control.