How to Hide Gutenberg Blocks for Some Users
The Gutenberg editor has been with us for nearly 2 years now. I know it's not always popular to say, but we're big fans here at PublishPress.
After a bumpy start, the new editor is really useful now and it's about to get even better with Phase 3 of the Gutenberg project. We've recently committed to building a whole set of publishing tools around the editor and the PublishPress Blocks plugin.
In this guide, I'm going to show you to hide Gutenberg blocks that you don't want some WordPress users to access. As more plugin developers support Gutenberg, you may end up with a very long list of blocks. Or you may simply not want to give some users access to some functionality.
Hide Gutenberg blocks from yourself
The easiest way to hide blocks is by customizing your own personal settings.
- When you're writing a post, click the three vertical dots in the top-right corner.
- Click the “Block Manager” link.
- In this modal window, you can uncheck any blocks that you don't want to see:
I'll note several things about this method of hiding blocks:
- This change won't impact any other users.
- This will hide but not disable any blocks, so nothing will break if they are being used on your site.
- You can undo this change at any time.
Hide Gutenberg blocks from other users
It is also possible to completely hide blocks from some users and user roles.
Using the PublishPress Blocks plugin, you can create editor profiles for different users and user roles.
These profiles allow you to control which users can add which Gutenberg blocks. For example, if you want to prevent some users from adding “Table” blocks, you can block them from doing that with this profiles feature.
To get started, install the PublishPress Blocks plugin.
- Go to “PublishPress Blocks” in your WordPress admin menu.
- Click “Profiles”.
- Click the “Default” profile. This is the current profile for you and all the other uses on your site.
- If you disable a block here, it will be disable for all your others. In the image below, we are disabling the “Column” layout for everyone on the site.
You can create new profiles for other users. For example, you may want a very limited set of blocks for “Contributors”.
- Go to “Profiles”.
- Click “New Profile”
- Enter a “Profile title”.
- Disable any clicks you don't want these users to have access to.
- Click “Profile Attribution”
- Select any users you want to have this profile.
- Select any user roles you want to have this profile.
- Click “Save”
You have now created a custom Gutenberg experience for these users. Those users will not be able to enable these blocks again.
As with our first method in this tutorial, this second method will hide but not disable any blocks, so nothing will break if they are being used on your site.
More Gutenberg advice
We’ve written a lot about Gutenberg including on how to add GIF images and show code in Gutenberg, plus how to hide image captions or rearrange metaboxes.