WordPress: disable Gutenberg blocks

Photo by Fikret tozak on Unsplash

Ok, most of the time you to give your customers full access to every block type. But sometimes it’s better to disable certain block types like file, video file, …

Reasons

There can be multiple reasons why for you to disable specific block types, in your WordPress theme.

Media files

You should avoid letting users upload video files. This may cause problems in the future. That may result in uploads of hundreds of megabytes, uncompressed video.

Resulting in the customer ordering more storage for uploads.

Bottom line, always store videos or songs on Vimeo or SoundCloud.

There is no design

Your design may have no design for displaying a search, archive, RSS-feed, or a calendar.

https://wordpress.org/support/category/widget-blocks/

By experience I have had customers, afterwards emailing they want that calendar element also to be styled…

Solution

You can add the following code in your functions, by writing a hook and only return the ones you want to keep.

Resources

You can find the full list at:

Senior back-end developer in Ghent who likes writing sometimes weird / creative solutions to a specific problem.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store