One Way to Whitelist and Blacklist Blocks in Gutenberg

Gutenberg ships with a number of blocks but what if your client or project doesn’t need most of them? The Gutenberg Handbook explains how to create a whitelist and a blacklist for blocks but in some circumstances, Gutenberg does not respect the allowed_block_types filter.

Jason Bahl, a WordPress Engineer at Digital First Media, published a tutorial that explains how to whitelist and blacklist blocks using a filterable, localized array.

One thing to keep in mind is that Gutenberg development is in a high state of flux and Bahl warns that his technique is fragile and will likely cause things to break over time. He suggests keeping a close eye on Gutenberg development to see how blacklisting/whitelisting evolves in the plugin.

2

2 responses to “One Way to Whitelist and Blacklist Blocks in Gutenberg”

  1. This might be the start of a Customization API? I think about things like Roles, which Jason has said are not yet dealt with Server side, but we have a lot of things Server side…or do those somehow go Client side?

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.