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 Comments


  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?

    Report


  2. If you check [the stats](https://wordpress.org/plugins/gutenberg/advanced/) instead of the volume of hot air which some people are trying to blown up your petutie, you’ll find that the Average Install Growth Rate is at its lowest point ever, and Gutenblocks still rates just 2.5 stars, with more than twice as many people thinking its average to poor as those who think its the DBs.

    Report

Comments are closed.