In this article:
<p class="alert alert-danger">NOTE: In order to use this plugin you will need to be using the default editor for WordPress 5.0 (or greater) called Gutenberg. </p>
There may be an occasion where you will want to keep content on your WordPress site hidden from unregistered users. To do this, you can create secured posts (accessible by password), or you may want to try a plugin called Secure Blocks for Gutenberg. This plugin allows you to make specific blocks visible only to your registered leaders. Follow the article below to learn how to load and then use the plugin with your WordPress site.
<p class="alert alert-info">If you need a new home for your WordPress site then you should consider InMotion's WordPress Hosting solutions! These server plans include optimized and managed services that are priced to match your budget and performance needs.</p>
Installing and Activating the Secure Blocks Plugin
As with any WordPress plugin, you will need to be logged into the WordPress Administrator Dashboard as an administrator to perform any of these steps.
- In the main WordPress menu, click on Plugins.
- Click on Add New.
- Use the search field in the top right corner to find the plugin by typing, “Secure Blocks.”
- This will bring up several plugins, but you will want to select the plugin labeled Secure Blocks for Gutenberg. Click on Install.
- After the plugin finishes installing, the button’s label will change to Activate. Click on this button to launch the plugin.
Congratulations! You have completed the installation of the plugin! The plugin will add an entry into the blocks available in the Gutenberg editor.
Using the Secure Blocks Plugin
To use the new secure blocks feature, you will need to be either editing or creating a new post or page. You can find the block by using the “Search for a block” field and typing “Secure Block’. You can see the icon for the block in the screenshot below.
When you select the block you will see two fields, one for users who are signed in and one for everyone else.
Using this block is very simple. When you have added it, you have a field for your registered users (labeled “logged-in”) and one for everyone else. You even add blocks in either location. For example, you may want to show an illustration or image that is visible only to your registered users. Once you have the added the block, simply click on it to add content.
The end result is transparent to your viewers. If they’re registered, then they will only see the content in the block that applies to them.
Congratulations! That’s how you use the Secure Blocks for the Gutenberg plugin for WordPress. If you want to learn more about using WordPress, then check our tutorial on Adding HTML to a WordPress Page/Post.