1. 9
    Filter Blocks Types that are Exposed in Gutenberg for a Predictable Headless WordPress API
    2m 27s

Filter Blocks Types that are Exposed in Gutenberg for a Predictable Headless WordPress API

Share this video with your friends

Send Tweet

There are dozens of options available in Gutenberg for building a post, the amount of data coming through the Headless WordPress API can make it hard to manage presentation on the front end. To handle this we can filter out blocks that we won't use so that we can reasonably expect what data will be coming through the API.

In this lesson, we will limit the blocks available in the editor by adding the allowed_block_types filter.

Simeon Bateman
~ 3 months ago

I am sure using child themes is outside the scope of this course, but you should at least mention the risks of editing a theme directly.

When using a theme developed by someone else they will occasionally have updates posted by the developers. If you take the update, your changes could be overridden. So it's always a good idea to make a child theme before starting to make changes. Then your changes can be protected for future updates to the parent theme.

Kevin Cunninghaminstructor
~ 3 months ago

Super helpful, Simeon! Thanks for sharing. I'll think about how best to communicate that.

infoalberghi
~ 2 months ago

Thanks for the course, really interesting! Do you have a list or can suggest what types of blocks filter for an average blogging experience?

Kevin Cunninghaminstructor
~ 2 months ago

Hey!

Glad you've enjoyed the course so far.

It really depends on what you want. It's worth having a look on blogging platforms like Medium, Hashnode, etc. and have a think about what you'd like on your platform.

For me it would be something like:

  • Headers (maybe three levels)
  • Paragraph
  • Divider
  • List
  • Image
  • Code block

Yours might be different, though.