Disable Gutenberg Blocks

Once I decided to use Gutenberg editor for my websites I faced with is the huge amount of default blocks, which is cool of course, but I’m such a minimalist.

In this tutorial I am going to show several ways how you can hide or completely restrict the usage of specific blocks on your website.

Gutenberg Block Manager

In this method we are not going to do any coding yet. This method was not possible before but in WordPress 5.2 the Block Manager was introduced – it is a build-in feature that allows you to turn off or turn on specific blocks on your website, at the moment of writing this article it is located in Preferences > Blocks. Very cool especially if you are not really into coding.

This is how it works:

Gutenberg block manager
You can turn off the whole block groups here.

But of course if you develop a custom theme and it shouldn’t support a certain block, you’d better deactivate the blocks via code and we are going to talk about in just a little bit.

Disable Gutenberg Blocks in Code

Using allowed_block_types_all to whitelist blocks

Or allowed_block_types, depends on your WordPress version. I mean we used allowed_block_types before but then it became deprecated in WordPress 5.8 and now we have to use allowed_block_types_all filter.

So, using filter hook allowed_block_types_all we can whitelist some specific blocks, that we are going to allow to use on the website. Check the example below, where we are going to hide all the blocks except Paragraph, Heading, Image and List blocks.

 * Whitelist specific Gutenberg blocks (paragraph, heading, image and lists)
 * @author Misha Rudrastyh
 * @link https://rudrastyh.com/gutenberg/remove-default-blocks.html#allowed_block_types_all
add_filter( 'allowed_block_types_all', 'misha_allowed_block_types', 25, 2 );
function misha_allowed_block_types( $allowed_blocks, $editor_context ) {
	return array(

Once you insert this code to your current theme functions.php file, you would have this:

disable Gutenberg blocks using allowed_block_types_all
Now we only have blocks here that are listed in allowed_block_types_all filter.

A couple notes related to this code snippet

  • You might ask – but how to find out block slugs for the filter? If you try print_r( $allowed_blocks ), it returns nothing. Why? Because by default the allowed blocks array is empty, which means to display all blocks. If we add something to this array, only the blocks from the array will be displayed. To make it easier for you I decided to mention all the default blocks in the next chapter of this tutorial.
  • The filter also have $editor_context argument available, it contains the information about the admin page where the Block Editor is currently running. Using this argument we are going to add some post type related conditions later.

If you decide to use allowed_block_types_all filter, keep in mind, that neither plugins or themes will be able to add custom blocks! Here I described how to deal with that.

List of Gutenberg blocks

To make it more clear, I split the core blocks list by categories.

Text category:

Block slugBlock name
core/list and core/list-itemList

Media category:

Block slugBlock name
core/media-textMedia & Text

Design category:

Block slugBlock name
core/nextpagePage Break

Widgets category:

Block slugBlock name
core/htmlCustom HTML
core/latest-commentsLatest Comments
core/latest-postsLatest Posts
core/page-listPage List
core/social-linksSocial Icons
core/tag-cloudTag Cloud

Theme category:

Block slugBlock name
core/site-logoSite Logo
core/site-titleSite Title
core/site-taglineSite Tagline
core/queryQuery Loop
core/posts-listPosts List
core/post-titlePost Title
core/post-excerptPost Excerpt
core/post-featured-imagePost Featured Image
core/post-contentPost Content
core/post-authorPost Author
core/post-datePost Date
core/post-termsPost Categories,
Post Tags
core/post-navigation-linkNext post,
Previous post
core/read-moreRead More
core/comments-query-loopComments Query Loop
core/post-comments-formPost Comments Form
core/term-descriptionTerm Description
core/query-titleArchive Title
core/post-author-biographyPost Author Biography

Embeds category:

Block slugBlock name
core/embedEmbed, Twitter, Youtube, WordPress, Soundcloud, Spotify, Flickr, Vimeo, Animoto, Cloudup, Crowdsignal, Dailymotion, Imgur, Issuu, Kickstarter, Mixcloud, Reddit, ReverbNation, Screencast, Scribd, Slideshare, SmugMug, Speaker Desc, TikTok, Videopress, WordPress.tv, Amazon Kindle, Pinterest, Wolfram

Allow or Disallow Blocks for Specific Post Types

Do you remember, I mentioned that allowed_block_types_all hook accepts $editor_context parameter? Let’s use it now! For example, we will add one more block – Shortcode for Pages. In this case our code will be changed a little bit:

add_filter( 'allowed_block_types_all', 'misha_allowed_block_types', 25, 2 );
function misha_allowed_block_types( $allowed_blocks, $editor_context ) {
	$allowed_blocks = array(
	if( 'page' === $editor_context->post->post_type ) {
		$allowed_blocks[] = 'core/shortcode';
	return $allowed_blocks;

In this code snippet we get post type from a WP_Post object, it is located, as you’ve probably guessed, in $editor_context->post. So, you can even allow or disallow specific blocks by the post ID!

Here is my result for Pages:

Turn on or turn off certain Gutenberg blocks for a specific post type

How to Blacklist Specific Blocks?

In the examples above we used more like a whitelist solution. So we can specify specific blocks to whitelist – all the other blocks are going to be disabled. Like without exception at all. It means that not a single plugin that extends Gutenberg editor with blocks is going to do anything. And if you decide to create a custom block it won’t appear in inserter until you add it to whitelist.

So whitelisting doesn’t seem like a flexible solution and that’s why I decided to cover a blacklisting topic here as well.

We can blacklist any block with the same allowed_block_types_all, but we will also need the list of all the registered blocks. WP_Block_Type_Registry::get_instance()->get_all_registered() will help us with that.

Check this code out:

$registered_block_slugs = array_keys( WP_Block_Type_Registry::get_instance()->get_all_registered() );

echo '<pre>' . print_r( $registered_block_slugs, true ) . '</pre>';

    [0] => core/archives
    [1] => core/avatar
    [2] => core/block
    [3] => core/calendar
    [4] => core/categories
	 ... and so on

Ok, let’s say that you don’t need Archives and Calendar blocks.

 * Blacklist specific Gutenberg blocks
 * @author Misha Rudrastyh
 * @link https://rudrastyh.com/gutenberg/remove-default-blocks.html#blacklist-blocks
add_filter( 'allowed_block_types_all', 'misha_blacklist_blocks' );
function misha_blacklist_blocks( $allowed_blocks ) {
	// get all the registered blocks
	$blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();

	// then disable some of them
	unset( $blocks[ 'core/archives' ] );
	unset( $blocks[ 'core/calendar' ] );

	// return the new list of allowed blocks
	return array_keys( $blocks );

Do not forget to check the comments section below for more useful examples.

Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on X