Skip to content
A jumble of foam numbers

Gutenberg Components - "I only need one"

Friday, 12 April 2019

At 222 words, this article should take about 1 minute to read.

This article is more than a year old and the information in it may be out of date.

Gutenberg comes with an awful lot of default components (see list below) most of which will never be used in our websites.

It's perfectly possible to just leave them there but this has the potential for disaster.

Leaving them visible to the content manager raises two possibilities;

  1. It will be difficult for them to find the actual component they want to use
  2. They will try to use a component that we haven't styled which will break the layout on the frontend

So, what do we do...?

Only show the components you will actually use

Drop this into your functions.php file or, better yet, write a plugin to handle it 😎

add_filter('allowed_block_types', 'txb_allowed_block_types', 10, 2);

function txb_allowed_block_types( $allowed_blocks, $post )
{
    $allowed_blocks = array(
      'core/image', // Add the blocks you want here...
      'core/paragraph',
      'core/heading',
      'acf/videum' // Add your custom blocks here
    );

    return $allowed_blocks;

}

Gutenberg Default Components

  • Paragraph
  • Heading
  • Image
  • List
  • Quote
  • Gallery
  • Audio
  • Cover
  • File
  • Video
  • Code
  • Preformatted
  • Classic Block
  • Custom HTML
  • Pullquote
  • Table
  • Verse
  • Columns
  • Separator
  • Button
  • Media & Text
  • More
  • Page Break
  • Spacer
  • Shortcode
  • Archives
  • Categories
  • Latest Comments
  • Latest Posts
  • Embed
  • Twitter
  • YouTube
  • Facebook
  • Instagram
  • WordPress
  • SoundCloud
  • Spotify
  • Flickr
  • Vimeo
  • Animoto
  • Cloudup
  • CollegeHumor
  • Crowdsignal
  • Dailymotion
  • Funny or Die
  • Hulu
  • Imgur
  • Issuu
  • Kickstarter
  • Meetup.com
  • Mixcloud
  • Photobucket
  • Reddit
  • ReverbNation
  • Screencast
  • Scribd
  • Slideshare
  • SmugMug
  • Speaker Deck
  • TED
  • Tumblr
  • VideoPress
  • WordPress.tv

Fin

Comments

In almost all cases, the comments section is a vile cesspool of Reply Guys, racists, and bots.

I don't want to have to deal with that kind of hell so I don't have a comments section.

If you want to continue the conversation, you can always hit me up on Mastodon (which is not a vile cesspool of Reply Guys, racists, and bots).

Thomas Rigby

Thomas Rigby

When I'm not building things for the internet, I take photos of stuff.

Pronouns: he/him/his

Real. Simple. Syndication.

Get my latest content in your favorite RSS reader. I use InoReader but you don't have to.

What even is an RSS feed?!

Subscribe

Last played

Burn the Bitch

Ulver || Svidd Neger

Listen
Loading Invisible Visible RSS Navigation Close Arrow Info Online Online